Журнал лабораторных работ

Содержание

Журнал

Четверг (09/10/09)

/dev/ttyp8
11:17:44
#[user@fbsd5:~]$ vim /etc/group
user590:*:1092:
user591:*:1093:
user592:*:1094:
user593:*:1095:
user594:*:1096:
user595:*:1097:
user596:*:1098:
user597:*:1099:
user598:*:1100:
user599:*:1101:
user600:*:1102:
11:18:12
#[user@fbsd5:~]$

11:18:12
#[user@fbsd5:~]$

11:18:12
#[user@fbsd5:~]$

11:18:12
#[user@fbsd5:~]$

11:18:13
#[user@fbsd5:~]$ exit
exit
Connection to 192.168.16.25 closed.
прошло 28 минут
11:46:28
$ls -ld /tmp
drwxrwxrwt 9 root root 2360 2009-09-10 12:13 /tmp
11:46:31
$ls -l /etc/shadow
-rw-r----- 1 root shadow 13572 2009-09-10 12:12 /etc/shadow
11:54:30
$vim /etc/shadow
11:54:36
$ls -l /etc/shadow
-rw-r----- 1 root shadow 13572 2009-09-10 12:12 /etc/shadow
11:54:37
$ls -l /etc/shadow
-rw-r----- 1 root shadow 13572 2009-09-10 12:12 /etc/shadow
11:54:54
$sudo
[user@debian1:scripts]$ vim /etc/shadow
Password:
11:55:01
$ls -l /etc/shadow
-rw-r----- 1 root shadow 13572 2009-09-10 12:12 /etc/shadow
11:55:02
$cp /etc/shadow /tmp
cp: невозможно открыть `/etc/shadow' для чтения: Permission denied
11:55:38
$sudo

11:55:41
$sudo chmod 0000 /tmp/shadow

11:55:53
$sudo ls -l /tmp/shadow
---------- 1 root root 13572 2009-09-10 12:55 /tmp/shadow
11:56:06
$sudo vim /tmp/shadow
12:04:51
$ls /root/
[user@debian1:scripts]$ sudo vim /tmp/shadow
1234
12:04:56
$sudo
1234
прошла 61 минута
/dev/ttyp5
13:06:17
$screen -x
/dev/ttyp8
13:06:25
$ls -l
итого 40
-rwxr-xr-x 1 user user 327 2009-09-09 16:12 case1
-rwxr-xr-x 1 user user 277 2009-09-09 16:21 case2
-rwxr-xr-x 1 user user  85 2009-09-09 15:16 for1
-rwxr-xr-x 1 user user 129 2009-09-09 15:20 for2
-rwxr-xr-x 1 root root 172 2009-09-09 15:30 for3
-rwxr-xr-x 1 user user 254 2009-09-09 15:38 for4
-rwxr-xr-x 1 user user 145 2009-09-09 15:57 select1
-rwxr-xr-x 1 user user 188 2009-09-10 10:58 ssh-port-forwarding
-rwxr-xr-x 1 user user  64 2009-09-09 16:02 while1
-rwxr-xr-x 1 user user 176 2009-09-09 16:07 while2
13:06:26
$touch testfile

13:06:32
$ls -l testfile
-rw-r--r-- 1 user user 0 2009-09-10 14:06 testfile
13:06:35
$w3m http://xgu.ru/wiki/Chmod
Chmod
Материал из Xgu.ru
Перейти к: навигация, поиск
сообщениеÑ[1]Ñи ответьте наÐнего‚в списокÐрассылки xen-devel письмом вида "I'm
using (no using) Kemari and I want it to be integrated (but I would if it was
integrated)".ÑХорошаяeвещь.=Поддержим.--½-rwx 01)  |Ðbc; }
# ls -l /etc/passwd | awk '{print $1}' | rwx2dig
Эта статья находится в процессе написания.
Чтобы передать права в формате\ls -l (rwxrwxrwx) в качестве аргумента chmod их
Еслиpвы"считаете, что её стоило бы доработать как можно быстрее, пожалуйста,
можно преобразовать при помощи простой функции:
скажите об этом.                                           | bc; }
rwx2dig() { ( echoÐibase=2;ÐechoÐobase=8;‚sedÑs/^.//»|ŒtrÐ--²-rwxÑ01Ð)ак аргумент для chmod:
     echo|"trm-- -rwxsStTo01b)|bc`; \"$var2\"e1>> /tmp/log.perm 2>>/tmp/log.err.
≪ ↑ ↓ Viewing <Chmod — Xgu.ru>
13:07:15
$rwx2dig() { ( echo ibase=2; echo obase=8; sed s/^.// |

13:07:15
$rwx2dig() { ( echo ibase=2; echo obase=8; sed s/^.// |

13:07:15
$#

13:07:56
$ls -l
итого 40
-rwxr-xr-x 1 user user 327 2009-09-09 16:12 case1
-rwxr-xr-x 1 user user 277 2009-09-09 16:21 case2
-rwxr-xr-x 1 user user  85 2009-09-09 15:16 for1
-rwxr-xr-x 1 user user 129 2009-09-09 15:20 for2
-rwxr-xr-x 1 root root 172 2009-09-09 15:30 for3
-rwxr-xr-x 1 user user 254 2009-09-09 15:38 for4
-rwxr-xr-x 1 user user 145 2009-09-09 15:57 select1
-rwxr-xr-x 1 user user 188 2009-09-10 10:58 ssh-port-forwarding
-rw-r--r-- 1 user user   0 2009-09-10 14:06 testfile
-rwxr-xr-x 1 user user  64 2009-09-09 16:02 while1
-rwxr-xr-x 1 user user 176 2009-09-09 16:07 while2
13:07:57
$ls -l

13:07:57
$ls -l

13:07:57
$#rwx2dig() { ( echo ibase=2; echo obase=8; sed s/^.// |

13:12:27
$ls -l testfile | rwx2dig
[user@debian1:scripts]$ rwx2dig testfile
(standard_in) 3: parse error
(standard_in) 3: illegal character: :
13:12:40
$ls -l
итого 40
-rwxr-xr-x 1 user user 327 2009-09-09 16:12 case1
-rwxr-xr-x 1 user user 277 2009-09-09 16:21 case2
-rwxr-xr-x 1 user user  85 2009-09-09 15:16 for1
-rwxr-xr-x 1 user user 129 2009-09-09 15:20 for2
-rwxr-xr-x 1 root root 172 2009-09-09 15:30 for3
-rwxr-xr-x 1 user user 254 2009-09-09 15:38 for4
-rwxr-xr-x 1 user user 145 2009-09-09 15:57 select1
-rwxr-xr-x 1 user user 188 2009-09-10 10:58 ssh-port-forwarding
-rw-r--r-- 1 user user   0 2009-09-10 14:06 testfile
-rwxr-xr-x 1 user user  64 2009-09-09 16:02 while1
-rwxr-xr-x 1 user user 176 2009-09-09 16:07 while2
13:12:49
$ls -l | cut -d 1
cut: вы должны задать список байт, символов или полей
Попробуйте `cut --help' для получения более подробного описания.
13:12:53
$ls -l | awk '{print$1}'
итого
-rwxr-xr-x
-rwxr-xr-x
-rwxr-xr-x
-rwxr-xr-x
-rwxr-xr-x
-rwxr-xr-x
-rwxr-xr-x
-rwxr-xr-x
-rw-r--r--
-rwxr-xr-x
-rwxr-xr-x
13:13:08
$ls -l | awk '{print$1 $8
>
13:13:22
$ls -l | awk '{print$1 $8}'
итого
-rwxr-xr-xcase1
-rwxr-xr-xcase2
-rwxr-xr-xfor1
-rwxr-xr-xfor2
-rwxr-xr-xfor3
-rwxr-xr-xfor4
-rwxr-xr-xselect1
-rwxr-xr-xssh-port-forwarding
-rw-r--r--testfile
-rwxr-xr-xwhile1
-rwxr-xr-xwhile2
13:13:23
$ls -l | awk '{print$1" "
итого
-rwxr-xr-x case1
-rwxr-xr-x case2
-rwxr-xr-x for1
-rwxr-xr-x for2
-rwxr-xr-x for3
-rwxr-xr-x for4
-rwxr-xr-x select1
-rwxr-xr-x ssh-port-forwarding
-rw-r--r-- testfile
-rwxr-xr-x while1
-rwxr-xr-x while2
13:13:26
$ls -l | awk '{print$1" " $8}' | rwx2dig
(standard_in) 3: illegal character: \321
(standard_in) 3: illegal character: \202
(standard_in) 3: illegal character: \320
(standard_in) 3: illegal character: \276
(standard_in) 3: illegal character: \320
(standard_in) 3: illegal character: \263
(standard_in) 3: illegal character: \320
(standard_in) 3: illegal character: \276
(standard_in) 4: parse error
(standard_in) 5: parse error
(standard_in) 6: parse error
(standard_in) 7: parse error
(standard_in) 8: parse error
(standard_in) 9: parse error
(standard_in) 10: parse error
(standard_in) 11: parse error
(standard_in) 12: parse error
(standard_in) 13: parse error
(standard_in) 14: parse error
13:13:30
$ls -l | awk '{print$1
(standard_in) 3: illegal character: \321
(standard_in) 3: illegal character: \202
(standard_in) 3: illegal character: \320
(standard_in) 3: illegal character: \276
(standard_in) 3: illegal character: \320
(standard_in) 3: illegal character: \263
(standard_in) 3: illegal character: \320
(standard_in) 3: illegal character: \276
755
755
755
755
755
755
755
755
644
755
755
13:13:37
$ls -l | awk '{print$1}' | rwx2dig
(standard_in) 3: illegal character: \321
(standard_in) 3: illegal character: \202
(standard_in) 3: illegal character: \320
(standard_in) 3: illegal character: \276
(standard_in) 3: illegal character: \320
(standard_in) 3: illegal character: \263
(standard_in) 3: illegal character: \320
(standard_in) 3: illegal character: \276
755
755
755
755
755
755
755
755
644
755
755
13:13:39
$ls -l | awk '{print$1}'
итого
-rwxr-xr-x
-rwxr-xr-x
-rwxr-xr-x
-rwxr-xr-x
-rwxr-xr-x
-rwxr-xr-x
-rwxr-xr-x
-rwxr-xr-x
-rw-r--r--
-rwxr-xr-x
-rwxr-xr-x
13:13:42
$ls -l

13:13:42
$w3m http://xgu.ru/wiki/Chmod

13:15:02
$ls -l testfile
-rw-r--r-- 1 user user 0 2009-09-10 14:06 testfile
13:15:07
$ls -l testfile | awk '{print$1}'
-rw-r--r--
13:15:18
$ls -l testfile | awk '{print$1}' | rwx2dig
644
13:15:22
$ls -l ../
итого 5223
-rw-r--r--  1 user user       0 2009-09-10 10:52 1234
-rw-r--r--  1 user user       0 2009-09-09 13:07 5 6
-rw-r--r--  1 user user    2803 2009-09-07 14:26 adduser.conf
-rw-r--r--  1 user user      44 2009-09-07 14:26 adjtime
-rw-r--r--  1 user user    1071 2009-09-07 14:26 bash.bashrc
-rw-r--r--  1 user user  215907 2009-09-07 14:26 bash_completion
-rw-r--r--  1 user user     525 2009-09-07 14:26 console-cyrillic
-rw-r--r--  1 user user      31 2009-09-08 12:59 copied_stream
-rw-r--r--  1 user user     724 2009-09-07 14:26 crontab
...
-rw-r--r--  1 user user     777 2009-09-07 14:26 sysctl.conf
-rw-r--r--  1 user user    1664 2009-09-07 14:26 syslog.conf
drwxr-xr-x  7 user user     408 2009-09-07 14:38 test
-rw-r--r--  1 user user      12 2009-09-07 14:26 timezone
-rw-r--r--  1 user user    1260 2009-09-07 14:26 ucf.conf
-rw-r--r--  1 user user     805 2009-09-07 14:26 updatedb.conf
-rw-r--r--  1 user user    1076 2009-09-10 12:10 usermod-help
-rw-r--r--  1 user user   18545 2009-09-07 16:43 vim-file
-rw-r--r--  1 user user    4622 2009-09-07 14:26 vnc.conf
-rw-r--r--  1 user user    4221 2009-09-07 14:26 wgetrc
13:15:52
$ls -ld
drwxrwxrwt 9 root root 2384 2009-09-10 14:06 ../
13:16:00
$umask
0022
13:16:02
$ls -l testfile | awk '{print$1}' | rwx2dig
644
13:16:10
$cd

13:16:21
$touch testfile

13:16:37
$umask
[user@debian1:~]$ ls -l testfile | awk '{print$1}' | rwx2dig
644
0022
13:16:41
$ls -l testfile
-rw-r--r-- 1 user user 0 2009-09-10 14:16 testfile
13:17:39
$mkdir testdit

13:17:51
$ls -l testfile
^?-rw-r--r-- 1 user user 0 2009-09-10 14:16 testfile
13:17:53
$ls -l test
testdit/  testfile
13:17:53
$ls -ld
drwxr-xr-x 2 user user 48 2009-09-10 14:17 testdit/
13:24:06
$ssh 192.168.16.25
[user@debian1:~]$
Password:
Last login: Thu Sep 10 12:14:14 2009 from 192.168.16.1
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
        The Regents of the University of California.  All rights reserved.
FreeBSD 6.3-RELEASE (SMP) #0: Wed Jan 16 04:45:45 UTC 2008
Welcome to FreeBSD!
Before seeking technical support, please use the following resources:
o  Security advisories and updated errata information for all releases are
   at http://www.FreeBSD.org/releases/ - always consult the ERRATA section
...
   http://www.FreeBSD.org/search/.  If the doc distribution has
   been installed, they're also available formatted in /usr/share/doc.
If you still have a question or problem, please take the output of
`uname -a', along with any relevant error messages, and email it
as a question to the questions@FreeBSD.org mailing list.  If you are
unfamiliar with FreeBSD's directory layout, please refer to the hier(7)
manual page.  If you are not familiar with manual pages, type `man man'.
You may also use sysinstall(8) to re-enter the installation and
configuration utility.  Edit /etc/motd to change this login announcement.
l3-agent is already running: pid=20393; pidfile=/home/user/.lilalo/l3-agent.pid
прошло 25 минут
13:49:48
#[user@fbsd5:~]$

13:49:54
#[user@fbsd5:~]$

13:49:54
#[user@fbsd5:~]$

13:50:04
#[user@fbsd5:~]$ sudo pw useradd help | less
13:50:12
#[user@fbsd5:~]$ sudo pw useradd help &>/tmp/pw

13:50:57
#[user@fbsd5:~]$
usage: pw useradd [name] [switches]
        -V etcdir      alternate /etc location
        -C config      configuration file
        -q             quiet operation
  Adding users:
        -n name        login name
        -u uid         user id
        -c comment     user name/comment
        -d directory   home directory
        -e date        account expiry date
...
        -g group       default group
        -G grp1,grp2   additional groups
        -L class       default user class
        -k dir         default home skeleton
        -M mode        home directory permissions
        -u min,max     set min,max uids
        -i min,max     set min,max gids
        -w method      set default password method
        -s shell       default shell
        -y path        set NIS passwd file path
13:50:57
#[user@fbsd5:~]$

13:50:57
#[user@fbsd5:~]$

прошло 17 минут
14:08:56
$cd /tmp

/dev/ttypd
14:09:23
$mkdir 123
mkdir: невозможно создать каталог `123': File exists
14:09:28
$ls -ld 123
drwxr-xr-x 2 user user 72 2009-09-07 15:54 123
14:09:32
$chown root 123
chown: изменение владельца `123': Operation not permitted
14:09:37
$cd /tmp

14:09:59
$mkdir 345

14:10:03
$chown root 345
chown: изменение владельца `345': Operation not permitted
14:10:08
$whereis chown
chown: /bin/chown /usr/share/man/man1/chown.1.gz
14:12:23
$man 2 chown
14:13:22
$ls -l /bin/chown
[user@debian1:tmp]$ man -a chown
Переформатирование chown(1), подождите...
              Change the owner of /u and subfiles to "root".
AUTHOR
       Written by David MacKenzie and Jim Meyering.
REPORTING BUGS
       Report bugs to <bug-coreutils@gnu.org>.E...
       chown [OPTION]... --reference=RFILE FILE...
COPYRIGHT
       Copyright © 2006 Free Software Foundation, Inc.
...
       --help display this help and exit
       --version
              output version information and exit
       Owner is unchanged if missing.  Group is unchanged if missing, but changed to login group if implied by a ‘:’ following a symbolic OWNER.  OWNER and GROUP may be numeric as well as symbolic.
EXAMPLES
       chown root /u
              Change the owner of /u to "root".
       chown root:staff /u
              Likewise, but also change its group to "staff".
       chown -hR root /u
14:13:32
$sudo chmod 4755 /bin/chown
Password:
14:13:58
$ls -l /bin/chown
-rwsr-xr-x 1 root root 35356 2007-01-30 20:51 /bin/chown
14:14:02
$ls
1234          bash_completion   debian_version  host.conf    inittab      ld.so.hwcappkgs  magic           modules    networks       protocols     ru.utf-8.sug  shells          test           vnc.conf
345           console-cyrillic  deluser.conf    hostname     inputrc      locale.gen       mailcap         motd       nsswitch.conf  rc.local      screenrc      squid.conf      timezone       wgetrc
5 6           copied_stream     etc             hosts        issue        localtime        mailcap.order   motd.tail  pam.conf       resolv.conf   scripts       ssh-iiKsE20268  ucf.conf
adduser.conf  crontab           file            hosts.allow  issue.net    login.defs       manpath.config  mtab       passwd         rmt           securetty     sudoers         updatedb.conf
adjtime       day2              fstab           hosts.deny   ld.so.cache  logrotate.conf   mime.types      nanorc     passwd-        rpc           services      sysctl.conf     usermod-help
bash.bashrc   debconf.conf      group           inetd.conf   ld.so.conf   lynx.cfg         mke2fs.conf     Net        profile        ru.utf-8.spl  shadow        syslog.conf     vim-file
14:14:13
$chown root 345

/dev/ttyp8
14:14:51
$ls
1234              hosts            mime.types     ru.utf-8.sug
345               hosts.allow      mke2fs.conf    screenrc
5 6               hosts.deny       modules        scripts
adduser.conf      inetd.conf       motd           securetty
adjtime           inittab          motd.tail      services
bash.bashrc       inputrc          mtab           shadow
bash_completion   issue            nanorc         shells
console-cyrillic  issue.net        Net            squid.conf
copied_stream     ld.so.cache      networks       ssh-iiKsE20268
crontab           ld.so.conf       nsswitch.conf  sudoers
day2              ld.so.hwcappkgs  pam.conf       sysctl.conf
debconf.conf      locale.gen       passwd         syslog.conf
debian_version    localtime        passwd-        test
deluser.conf      login.defs       profile        timezone
etc               logrotate.conf   protocols      ucf.conf
file              lynx.cfg         rc.local       updatedb.conf
fstab             magic            resolv.conf    usermod-help
group             mailcap          rmt            vim-file
host.conf         mailcap.order    rpc            vnc.conf
hostname          manpath.config   ru.utf-8.spl   wgetrc
14:14:55
$mkdir permissions

14:15:02