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

Содержание

Журнал

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

/dev/ttyp8
09:49:40
$vim .ssh/config
--- /dev/null	2009-09-07 08:26:30.044750476 +0300
+++ .ssh/config	2009-09-10 10:50:31.000000000 +0300
@@ -0,0 +1,2 @@
+Host 192.168.16.2
+User root
09:50:32
$ssh 192.168.16.2
Last login: Thu Sep 10 10:48:14 2009 from 192.168.16.1
Linux debiant 2.6.18-5-xen-686 #1 SMP Fri Jun 1 05:05:24 UTC 2007 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
l3-agent is already running: pid=1255; pidfile=/root/.lilalo/l3-agent.pid
09:50:43
#exit
exit
Connection to 192.168.16.2 closed.
09:50:49
$vim
09:51:12
$ls -la .ssh/
итого 21
drwxr-xr-x  2 user user  192 2009-09-10 10:50 .
drwxr-xr-x 11 user user  752 2009-09-10 10:50 ..
-rw-r--r--  1 user user  393 2009-04-30 15:12 authorized_keys
-rw-r--r--  1 user user   28 2009-09-10 10:50 config
-rw-------  1 user user 1675 2009-09-10 10:46 id_rsa
-rw-r--r--  1 user user  394 2009-09-10 10:46 id_rsa.pub
-rw-r--r--  1 user user 3302 2009-09-10 10:45 known_hosts
09:51:14
$dat
bash: dat: command not found
09:51:21
$date
Чтв Сен 10 10:51:23 EEST 2009
09:51:23
$date

09:51:29
$scp 192.168.16.2:/root/1234 /tmp
1234                                          100%    0     0.0KB/s   00:00
09:54:22
$scp 192.168.16.2:/root/1234 /tmp

09:54:22
$ssh 192.168.16.2
Last login: Thu Sep 10 10:50:43 2009 from 192.168.16.1
Linux debiant 2.6.18-5-xen-686 #1 SMP Fri Jun 1 05:05:24 UTC 2007 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
l3-agent is already running: pid=1255; pidfile=/root/.lilalo/l3-agent.pid
09:54:55
#netstat -lnp | grep -q 127.0.0.1:3333

09:55:03
#netstat -lnp | grep -q 127.0.0.1:3333 ; echo$?
bash: echo1: command not found
09:55:10
#netstat -lnp | grep -q 127.0.0.1:3333 ; echo
1
09:55:13
#exit
exit
Connection to 192.168.16.2 closed.
09:55:28
$ssh -f -N -R 3333:127.0.0.1:22
ssh: netstat -lnp | grep -q 127.0.0.1: Name or service not known
lost connection
1
09:56:51
$ssh 192.168.16.2

09:56:55
$ssh -f -N -R 3333:127.0.0.1:22 192.168.16.2

09:56:55
$ssh 192.168.16.2

09:57:11
$scp 192.168.16.2 'netstat -lnp | grep -q 127.0.0.1:3333' ; ec
[user@debian1:~]$ ssh 192.168.16.2
09:57:11
$scp 192.168.16.2 'netstat -lnp | grep :3333'
ssh: netstat -lnp | grep : Name or service not known
lost connection
09:57:21
$whereis netstat
netstat: /bin/netstat /usr/share/man/man8/netstat.8.gz
09:57:34
$ssh 192.168.16.2

09:57:34
$ssh -f -N -R 3333:127.0.0.1:22 192.168.16.2

09:57:34
$ssh 192.168.16.2

09:57:54
$whereis netstat
[user@debian1:~]$ ssh
0
09:57:54
$ssh 192.168.16.2

09:57:54
$ls
=  1_2  123  3_4  hello  script  ug-ladm.pdf  ug-lnet.pdf
09:58:04
$ls /tmp/scripts/
case1  for1  for3  select1              while1
case2  for2  for4  ssh-port-forwarding  while2
09:58:11
$cd /tmp/scripts/

09:58:14
$chmod +x ssh-port-forwarding

09:58:20
$vim ssh-port-forwarding
--- /tmp/l3-saved-30657.3365.5621	2009-09-10 10:58:23.000000000 +0300
+++ ssh-port-forwarding	2009-09-10 10:58:26.000000000 +0300
@@ -1,5 +1,5 @@
 #!/bin/sh
-#set -x
+set -x
 IP=192.168.16.2
 ssh -o StrictHostKeyChecking=no root@$IP 'netstat -lnp | grep -q 127.0.0.1:55000' || ssh -o StrictHostKeyChecking=no -f -N -R 55000:127.0.0.1:22 root@$IP
 
09:58:26
$./ssh-port-forwarding
+ IP=192.168.16.2
+ ssh -o StrictHostKeyChecking=no root@192.168.16.2 'netstat -lnp | grep -q 127.0.0.1:55000'
+ ssh -o StrictHostKeyChecking=no -f -N -R 55000:127.0.0.1:22 root@192.168.16.2
09:59:06
$whereis netstat
[user@debian1:scripts]$ ./ssh-port-forwarding
+ IP=192.168.16.2
+ ssh -o StrictHostKeyChecking=no root@192.168.16.2 'netstat -lnp | grep -q 127.0.0.1:55000'
09:59:06
$ssh 192.168.16.2 'netstat -lnp | grep -q 127.0.0.1:3333

09:59:24
#ssh 127.0.0.1 -p 55000
[user@debian1:scripts]$ ssh 192.168.16.2
Last login: Thu Sep 10 10:54:54 2009 from 192.168.16.1
Linux debiant 2.6.18-5-xen-686 #1 SMP Fri Jun 1 05:05:24 UTC 2007 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
l3-agent is already running: pid=1255; pidfile=/root/.lilalo/l3-agent.pid
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
...
Warning: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
root@127.0.0.1's password:
Last login: Thu Sep 10 10:30:43 2009 from host203.net.nt
Linux debiant 2.6.18-5-xen-686 #1 SMP Fri Jun 1 05:05:24 UTC 2007 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
l3-agent is already running: pid=1256; pidfile=/root/.lilalo/l3-agent.pid
09:59:33
#exit
exit
Connection to 127.0.0.1 closed.
09:59:43
$w
[root@debian2:~]# ssh 127.0.0.1 -p 55000 -l user
user@127.0.0.1's password:
Linux debiant 2.6.18-5-xen-686 #1 SMP Fri Jun 1 05:05:24 UTC 2007 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Sep 10 10:27:52 2009 from 192.168.16.25
l3-agent is already running: pid=1406; pidfile=/home/user/.lilalo/l3-agent.pid
 10:59:48 up 3 days,  2:33,  8 users,  load average: 0,05, 0,02, 0,00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
user     ttyp0    host239.net.nt   Mon15    0.00s  2.84s  0.09s script -f -q /h
user     ttyp2    192.168.16.3     Wed11   20:07   0.34s  0.08s script -f -q /h
user     ttyp6    192.168.16.2     Wed11   18:38   0.28s  0.07s script -f -q /h
root     ttyp3    host203.net.nt   10:30   28:57m  0.01s  0.01s script -f -q /r
user     :0       -                Tue14   ?xdm?  30:24m  0.14s /usr/bin/fluxbo
user     ttyp9    :0.0             Tue14   44:22   0.05s  0.05s script -f -q /h
user     ttypd    localhost.locald 10:59    0.00s  0.08s  0.08s script -f -q /h
user     ttyp8    :ttyp5:S.0       Wed14    0.00s  0.14s  0.08s script -f -q /h
/dev/ttypd
09:59:43
$w
 10:59:48 up 3 days,  2:33,  8 users,  load average: 0,05, 0,02, 0,00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
user     ttyp0    host239.net.nt   Mon15    0.00s  2.84s  0.09s script -f -q /h
user     ttyp2    192.168.16.3     Wed11   20:07   0.34s  0.08s script -f -q /h
user     ttyp6    192.168.16.2     Wed11   18:38   0.28s  0.07s script -f -q /h
root     ttyp3    host203.net.nt   10:30   28:57m  0.01s  0.01s script -f -q /r
user     :0       -                Tue14   ?xdm?  30:24m  0.14s /usr/bin/fluxbo
user     ttyp9    :0.0             Tue14   44:22   0.05s  0.05s script -f -q /h
user     ttypd    localhost.locald 10:59    0.00s  0.08s  0.08s script -f -q /h
user     ttyp8    :ttyp5:S.0       Wed14    0.00s  0.14s  0.08s script -f -q /h
/dev/ttyp8
09:59:48
$exit
exit
Connection to 127.0.0.1 closed.
09:59:55
#exit
exit
Connection to 192.168.16.2 closed.
09:59:56
$cat ssh-port-forwarding
#!/bin/sh
set -x
IP=192.168.16.2
ssh -o StrictHostKeyChecking=no root@$IP 'netstat -lnp | grep -q 127.0.0.1:55000' || ssh -o StrictHostKeyChecking=no -f -N -R 55000:127.0.0.1:22 root@$IP
10:00:01
$crontab -e
# m h  dom mon dow   command
                               [ Wrote 2 lines ]
crontab: installing new crontab
10:00:29
$EDITOR=vim crontab -e
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"crontab.LoU0P4/crontab" 3L, 44C записано                              сь
crontab: installing new crontab
10:01:42
$cp ssh-port-forwarding ~

10:03:17
$sudo grep -r ssh /var/spool/cron/crontabs/
Password:
/var/spool/cron/crontabs/user:*/10 * * * *  /home/user/ssh-port-forwarding
прошло 18 минут
10:22:09
$man pam
прошла 21 минута
10:43:39
$sudo vim /etc/passwd
10:47:54
$sudo vim /etc/shadow
10:48:43
$sudo vim /etc/shadow
10:48:58
$man shadow
10:50:19
$man passwd
10:50:46
$man passwd
10:51:25
$whereis passwd
passwd: /usr/bin/passwd /etc/passwd /usr/X11R6/bin/passwd /usr/bin/X11/passwd /usr/share/man/man1/passwd.1.gz /usr/share/man/man5/passwd.5.gz
10:51:31
$strings /usr/bin/passwd | less
10:54:29
$sudo adduser
adduser: Можно указать только одно или два имени.
10:54:35
$sudo adduser yarik
Добавляется пользователь `yarik' ...
Добавляется новая группа `yarik' (1304) ...
Добавляется новый пользователь `yarik' (1304) в группу `yarik' ...
Создаётся домашний каталог `/home/yarik' ...
Копирование файлов из `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
Sorry, passwords do not match
passwd: Authentication information cannot be recovered
passwd: password unchanged
Попробовать ещё раз? [Д/н] y
Enter new UNIX password:
Retype new UNIX password:
Sorry, passwords do not match
passwd: Authentication information cannot be recovered
passwd: password unchanged
Попробовать ещё раз? [Д/н] n
Изменение информации о пользователе yarik
Введите новое значение или нажмите ВВОД для выбора значения по умолчанию
        Полное имя []: adduser: `/usr/bin/chfn yarik' завершился по сигналу 2. Завершение работы.
10:57:36
$sudo adduser yarik
adduser: Пользователь `yarik' уже существует.
10:58:57
$sudo adduser yarik3
[user@debian1:scripts]$ sudo adduser yarik2
Добавляется пользователь `yarik2' ...
Добавляется новая группа `yarik2' (1305) ...
Добавляется новый пользователь `yarik2' (1305) в группу `yarik2' ...
Создаётся домашний каталог `/home/yarik2' ...
Копирование файлов из `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: пароль успешно обновлён
Изменение информации о пользователе yarik2
...
Retype new UNIX password:
passwd: пароль успешно обновлён
Изменение информации о пользователе yarik3
Введите новое значение или нажмите ВВОД для выбора значения по умолчанию
        Полное имя []: Yaroslav
        Номер комнаты []: A2
        Рабочий телефон []: 102
        Домашний телефон []: 103
        Другое []: Other
Данная информация корректна? [д/Н] y
10:59:40
$sudo
  5 sync:x:4:65534:sync:/bin:/bin/sync
  6 games:x:5:60:games:/usr/games:/bin/sh
  7 man:x:6:12:man:/var/cache/man:/bin/sh
  8 lp:x:7:7:lp:/var/spool/lpd:/bin/sh
  9 mail:x:8:8:mail:/var/mail:/bin/sh
 10 news:x:9:9:news:/var/spool/news:/bin/sh
 11 uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
 12 proxy:x:13:13:proxy:/bin:/bin/sh
 13 www-data:x:33:33:www-data:/var/www:/bin/sh
 14 backup:x:34:34:backup:/var/backups:/bin/sh
 15 list:x:38:38:Mailing List Manager:/var/list:/bin/sh
 16 irc:x:39:39:ircd:/var/run/ircd:/bin/sh
 17 gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
 18 nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
 19 sshd:x:100:65534::/var/run/sshd:/usr/sbin/nologin
 20 gdm:x:101:103:Gnome Display Manager:/var/lib/gdm:/bin/false
 21 user:x:1000:1000:User,,,:/home/user:/bin/bash
 22 test:x:1001:1001:,,,:/home/test:/bin/bash
 23 user1:x:1002:1002::/home/user1:/bin/sh
vipw: /etc/passwd не был изменён
10:59:59
$sudo vim /etc/passwd
11:01:57
$sudo useradd -s /bin/bash -m -d /home/wwww wwww
 64 # regular expression when creating a new home directory
 65 SKEL_IGNORE_REGEX="dpkg-(old|new|dist)"
 66                         (            )
 67 # Set this if you want the --add_extra_groups option to adduser to add
 68 # new users to other groups.
 69 # This is the list of groups that new non-system users will be added to
 70 # Default:
 71 #EXTRA_GROUPS="dialout cdrom floppy audio src video lp src users"
 72
 73 # If ADD_EXTRA_GROUPS is set to something non-zero, the EXTRA_GROUPS
 74 # option above will be default behavior for adding new, non-system users
 34 # allocated user accounts/groups.                         74,27         98% рху
11:03:38
$sudo vim /etc/shadow
11:05:08
$id wwww
 31 # copied to the new user's home directory when it is created.
 32 # SKEL=/etc/skel
 33 #
 31 # copied to the new user's home directory when it is created.
 32 # SKEL=/etc/skel
 33 #
 34 # Defines whether the mail spool should be created while
 35 # creating the account
 36 # CREATE_MAIL_SPOOL=yes
uid=1307(wwww) gid=1307(wwww) группы=1307(wwww)
                                                     ¸Ñ] 37L,36,1          92%¸Ð·ÑƒÑƒ
11:05:12
$man useradd.conf\
11:05:20
$man 5
11:05:24
$man useradd
11:08:14
$sudo useradd -s /bin/bash -m -d /home/wwwww

11:08:30
$id wwwww
uid=1308(wwwww) gid=0(root) группы=0(root)
11:08:35
$vim /etc/group
11:09:24
$usermod --help
bash: usermod: command not found
11:09:38
$sudo
Usage: usermod [options] LOGIN
Options:
  -c, --comment COMMENT         new value of the GECOS field
  -d, --home HOME_DIR           new home directory for the user account
  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -f, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -g, --gid GROUP               force use GROUP as new primary group
  -G, --groups GROUPS           new list of supplementary GROUPS
  -a, --append          append the user to the supplemental GROUPS
...
  -h, --help                    display this help message and exit
  -l, --login NEW_LOGIN         new value of the login name
  -L, --lock                    lock the user account
  -m, --move-home               move contents of the home directory to the new
                                location (use only with -d)
  -o, --non-unique              allow using duplicate (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new password
  -s, --shell SHELL             new login shell for the user account
  -u, --uid UID                 new UID for the user account
  -U, --unlock                  unlock the user account
11:09:40
$sudo usermod --help | less
11:09:48
$sudo usermod --help > /tmp/usermod-help
Usage: usermod [options] LOGIN
Options:
  -c, --comment COMMENT         new value of the GECOS field
  -d, --home HOME_DIR           new home directory for the user account
  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -f, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -g, --gid GROUP               force use GROUP as new primary group
  -G, --groups GROUPS           new list of supplementary GROUPS
  -a, --append          append the user to the supplemental GROUPS
...
  -h, --help                    display this help message and exit
  -l, --login NEW_LOGIN         new value of the login name
  -L, --lock                    lock the user account
  -m, --move-home               move contents of the home directory to the new
                                location (use only with -d)
  -o, --non-unique              allow using duplicate (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new password
  -s, --shell SHELL             new login shell for the user account
  -u, --uid UID                 new UID for the user account
  -U, --unlock                  unlock the user account
11:09:54
$sudo usermod --help &

11:10:20
$sudo usermod -L yarik3

11:10:38
$vim /etc/shadow
11:10:53
$sudo usermod -L yarik2
[user@debian1:scripts]$ sudo
11:11:22
$sudo usermod -U yarik{2,3}
  -h, --help                    display this help message and exit
  -l, --login NEW_LOGIN         new value of the login name
  -L, --lock                    lock the user account
  -m, --move-home               move contents of the home directory to the new
                                location (use only with -d)
  -o, --non-unique              allow using duplicate (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new password
  -s, --shell SHELL             new login shell for the user account
  -u, --uid UID                 new UID for the user account
  -U, --unlock                  unlock the user account
                                                              328,8         99%¸Ð·ÑƒÑƒ
11:11:39
$sudo sh -c 'usermod -U yarik2 yarik3'
[user@debian1:scripts]$ sudo sh -c 'usermod -U yarik{2,3}'
Usage: usermod [options] LOGIN
Options:
  -c, --comment COMMENT         new value of the GECOS field
  -d, --home HOME_DIR           new home directory for the user account
  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -f, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -g, --gid GROUP               force use GROUP as new primary group
  -G, --groups GROUPS           new list of supplementary GROUPS
...
  -h, --help                    display this help message and exit
  -l, --login NEW_LOGIN         new value of the login name
  -L, --lock                    lock the user account
  -m, --move-home               move contents of the home directory to the new
                                location (use only with -d)
  -o, --non-unique              allow using duplicate (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new password
  -s, --shell SHELL             new login shell for the user account
  -u, --uid UID                 new UID for the user account
  -U, --unlock                  unlock the user account
11:11:54
$sudo sh -c 'usermod -U yarik2 yarik3'

11:12:08
$sudo usermod -U yarik2

11:12:13
$sudo usermod -U yarik3

11:12:14
$sudo vim /etc/shadow
11:12:35
$passwd
[user@debian1:scripts]$ sudo chfn yarik3
Изменение информации о пользователе yarik3
Введите новое значение или нажмите ВВОД для выбора значения по умолчанию
        Полное имя [Yaroslav]:
        Номер комнаты [A2]:
        Рабочий телефон [102]:
        Домашний телефон [103]:
        Другое [Other]:
Changing password for user
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
Password unchanged
Enter new UNIX password:
Retype new UNIX password:
No password supplied
Enter new UNIX password:
Retype new UNIX password:
No password supplied
passwd: Authentication token manipulation error
passwd: password unchanged
11:13:11
$ssh 192.168.16.25

11:13:50
$ssh 192.168.16.25 -o VerifyHostKeyDNS=no
                   UsePrivilegedPort
                   User
Password:          UserKnownHostsFile
     below).1:scripts]$ man ssh
Password:
     If command is specified, it is executed on the remote host instead of a
Last login: Thu Sep 10 10:26:31 2009
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
     -1 The Regents of the University of California.  All rights reserved.
     -2      Forces ssh to try protocol version 2 only.
...
             be forwarded to the given host and port on the local side.  This
You may also use sysinstall(8) to re-enter the installation andthe remoteThisn
configuration utility.  Edit /etc/motd to change this login announcement.nnec‐
             tion is forwarded over the secure channel, and a connection isry
l3-agent is already running: pid=20393; pidfile=/home/user/.lilalo/l3-agent.pid
             Agent forwarding should be enabled with caution.  Users with the
             Port forwardings can also be specified in the configuration file.
             Privileged ports can be forwarded only when logging in as root on
             the remote machine.  IPv6 addresses can be specified by enclosing
             the address in square braces or using an alternative syntax:
11:14:25
#[user@fbsd5:~]$

11:14:26
#[user@fbsd5:~]$

11:14:26
#[user@fbsd5:~]$

11:14:51
#[user@fbsd5:~]$ vim /tmp/pw-useradd_help
pw: illegal option -- -
pw: unknown switch
"/tmp/pw-useradd_help" 2 lines, 43 characters
11:14:56
#[user@fbsd5:~]$ sudo pw useradd -h &>/tmp/pw-useradd_help

11:15:06
#[user@fbsd5:~]$ sudo pw useradd help &>/tmp/pw-useradd_help
pw: option requires an argument -- h
pw: unknown switch
"/tmp/pw-useradd_help" 2 lines, 56 characters
11:16:27
#[user@fbsd5:~]$ vim /tmp/pw-useradd_help
usage: pw useradd [name] [switches]
        -V etcdir      alternate /etc location
        -C config      configuration file
        -q             quiet operation
  Adding-n name        login name
        -u uid         user id
        -c comment     user name/comment
        -d directory   home directory
        -e date        account expiry date
        -p date        password expiry date
...
        -m [ -k dir ]  create and set up home
        -M mode        home directory permissions
        -s shell       name of login shell
        -o             duplicate uid ok
        -L class       user class
        -h fd          read password on fd
        -H fd          read encrypted password on fd
        -Y             update NIS maps
        -N             no update
  Setting defaults:lp" 38 lines, 1308 characters
11:16:42
#[user@fbsd5:~]$

11:16:42
#[user@fbsd5:~]$

11:16:51
#[user@fbsd5:~]$ vim /tmp/pw-useradd_help
usage: pw userdel [uid|name] [switches]
        -V etcdir      alternate /etc location
        -n name        login name
        -u uid         user id
        -Y             update NIS maps
        -r             remove home & contents
"/tmp/pw-useradd_help" 6 lines, 202 characters
11:17:09
#[user@fbsd5:~]$ sudo pw usermod help &>/tmp/pw-useradd_help

11:17:31
#[user@fbsd5:~]$
[user@fbsd5:~]$ vim /tmp/pw-useradd_help
11:17:31
#[user@fbsd5:~]$

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:

Файлы

  • ssh-port-forwarding
  • ssh-port-forwarding
    >
    #!/bin/sh
    set -x
    IP=192.168.16.2
    ssh -o StrictHostKeyChecking=no root@$IP 'netstat -lnp | grep -q 127.0.0.1:55000' || ssh -o StrictHostKeyChecking=no -f -N -R 55000:127.0.0.1:22 root@$IP
    

    Статистика

    Время первой команды журнала09:49:40 2009- 9-10
    Время последней команды журнала11:17:44 2009- 9-10
    Количество командных строк в журнале101
    Процент команд с ненулевым кодом завершения, %20.79
    Процент синтаксически неверно набранных команд, % 2.97
    Суммарное время работы с терминалом *, час 1.47
    Количество командных строк в единицу времени, команда/мин 1.15
    Частота использования команд
    sudo25|=================| 17.61%
    [user@fbsd5:~]$14|=========| 9.86%
    ssh14|=========| 9.86%
    vim11|=======| 7.75%
    usermod9|======| 6.34%
    man7|====| 4.93%
    grep7|====| 4.93%
    exit5|===| 3.52%
    whereis4|==| 2.82%
    scp4|==| 2.82%
    adduser4|==| 2.82%
    >3|==| 2.11%
    pw-useradd_help3|==| 2.11%
    netstat3|==| 2.11%
    ls3|==| 2.11%
    useradd2|=| 1.41%
    id2|=| 1.41%
    sh2|=| 1.41%
    less2|=| 1.41%
    date2|=| 1.41%
    w2|=| 1.41%
    crontab1|| 0.70%
    passwd1|| 0.70%
    strings1|| 0.70%
    chmod1|| 0.70%
    cp1|| 0.70%
    cd1|| 0.70%
    echo1|| 0.70%
    ec1|| 0.70%
    dat1|| 0.70%
    EDITOR=vim1|| 0.70%
    cat1|| 0.70%
    echo$?1|| 0.70%
    ssh-port-forwarding1|| 0.70%
    usermod-help1|| 0.70%
    ____
    *) Интервалы неактивности длительностью 30 минут и более не учитываются

    Справка

    Для того чтобы использовать LiLaLo, не нужно знать ничего особенного: всё происходит само собой. Однако, чтобы ведение и последующее использование журналов было как можно более эффективным, желательно иметь в виду следующее:
    1. В журнал автоматически попадают все команды, данные в любом терминале системы.

    2. Для того чтобы убедиться, что журнал на текущем терминале ведётся, и команды записываются, дайте команду w. В поле WHAT, соответствующем текущему терминалу, должна быть указана программа script.

    3. Команды, при наборе которых были допущены синтаксические ошибки, выводятся перечёркнутым текстом:
      $ l s-l
      bash: l: command not found
      

    4. Если код завершения команды равен нулю, команда была выполнена без ошибок. Команды, код завершения которых отличен от нуля, выделяются цветом.
      $ test 5 -lt 4
      Обратите внимание на то, что код завершения команды может быть отличен от нуля не только в тех случаях, когда команда была выполнена с ошибкой. Многие команды используют код завершения, например, для того чтобы показать результаты проверки

    5. Команды, ход выполнения которых был прерван пользователем, выделяются цветом.
      $ find / -name abc
      find: /home/devi-orig/.gnome2: Keine Berechtigung
      find: /home/devi-orig/.gnome2_private: Keine Berechtigung
      find: /home/devi-orig/.nautilus/metafiles: Keine Berechtigung
      find: /home/devi-orig/.metacity: Keine Berechtigung
      find: /home/devi-orig/.inkscape: Keine Berechtigung
      ^C
      

    6. Команды, выполненные с привилегиями суперпользователя, выделяются слева красной чертой.
      # id
      uid=0(root) gid=0(root) Gruppen=0(root)
      

    7. Изменения, внесённые в текстовый файл с помощью редактора, запоминаются и показываются в журнале в формате ed. Строки, начинающиеся символом "<", удалены, а строки, начинающиеся символом ">" -- добавлены.
      $ vi ~/.bashrc
      2a3,5
      >    if [ -f /usr/local/etc/bash_completion ]; then
      >         . /usr/local/etc/bash_completion
      >        fi
      

    8. Для того чтобы изменить файл в соответствии с показанными в диффшоте изменениями, можно воспользоваться командой patch. Нужно скопировать изменения, запустить программу patch, указав в качестве её аргумента файл, к которому применяются изменения, и всавить скопированный текст:
      $ patch ~/.bashrc
      В данном случае изменения применяются к файлу ~/.bashrc

    9. Для того чтобы получить краткую справочную информацию о команде, нужно подвести к ней мышь. Во всплывающей подсказке появится краткое описание команды.

      Если справочная информация о команде есть, команда выделяется голубым фоном, например: vi. Если справочная информация отсутствует, команда выделяется розовым фоном, например: notepad.exe. Справочная информация может отсутствовать в том случае, если (1) команда введена неверно; (2) если распознавание команды LiLaLo выполнено неверно; (3) если информация о команде неизвестна LiLaLo. Последнее возможно для редких команд.

    10. Большие, в особенности многострочные, всплывающие подсказки лучше всего показываются браузерами KDE Konqueror, Apple Safari и Microsoft Internet Explorer. В браузерах Mozilla и Firefox они отображаются не полностью, а вместо перевода строки выводится специальный символ.

    11. Время ввода команды, показанное в журнале, соответствует времени начала ввода командной строки, которое равно тому моменту, когда на терминале появилось приглашение интерпретатора

    12. Имя терминала, на котором была введена команда, показано в специальном блоке. Этот блок показывается только в том случае, если терминал текущей команды отличается от терминала предыдущей.

    13. Вывод не интересующих вас в настоящий момент элементов журнала, таких как время, имя терминала и других, можно отключить. Для этого нужно воспользоваться формой управления журналом вверху страницы.

    14. Небольшие комментарии к командам можно вставлять прямо из командной строки. Комментарий вводится прямо в командную строку, после символов #^ или #v. Символы ^ и v показывают направление выбора команды, к которой относится комментарий: ^ - к предыдущей, v - к следующей. Например, если в командной строке было введено:

      $ whoami
      
      user
      
      $ #^ Интересно, кто я?
      
      в журнале это будет выглядеть так:
      $ whoami
      
      user
      
      Интересно, кто я?

    15. Если комментарий содержит несколько строк, его можно вставить в журнал следующим образом:

      $ whoami
      
      user
      
      $ cat > /dev/null #^ Интересно, кто я?
      
      Программа whoami выводит имя пользователя, под которым 
      мы зарегистрировались в системе.
      -
      Она не может ответить на вопрос о нашем назначении 
      в этом мире.
      
      В журнале это будет выглядеть так:
      $ whoami
      user
      
      Интересно, кто я?
      Программа whoami выводит имя пользователя, под которым
      мы зарегистрировались в системе.

      Она не может ответить на вопрос о нашем назначении
      в этом мире.
      Для разделения нескольких абзацев между собой используйте символ "-", один в строке.

    16. Комментарии, не относящиеся непосредственно ни к какой из команд, добавляются точно таким же способом, только вместо симолов #^ или #v нужно использовать символы #=

    17. Содержимое файла может быть показано в журнале. Для этого его нужно вывести с помощью программы cat. Если вывод команды отметить симоволами #!, содержимое файла будет показано в журнале в специально отведённой для этого секции.
    18. Для того чтобы вставить скриншот интересующего вас окна в журнал, нужно воспользоваться командой l3shot. После того как команда вызвана, нужно с помощью мыши выбрать окно, которое должно быть в журнале.
    19. Команды в журнале расположены в хронологическом порядке. Если две команды давались одна за другой, но на разных терминалах, в журнале они будут рядом, даже если они не имеют друг к другу никакого отношения.
      1
          2
      3   
          4
      
      Группы команд, выполненных на разных терминалах, разделяются специальной линией. Под этой линией в правом углу показано имя терминала, на котором выполнялись команды. Для того чтобы посмотреть команды только одного сенса, нужно щёкнуть по этому названию.

    О программе

    LiLaLo (L3) расшифровывается как Live Lab Log.
    Программа разработана для повышения эффективности обучения Unix/Linux-системам.
    (c) Игорь Чубин, 2004-2008

    $Id$