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

Содержание

Журнал

Среда (09/30/15)

/dev/pts/0
09:30:16
#set | grep ^c
c=10
09:30:20
#env
SHELL=/bin/bash
TERM=xterm
HISTSIZE=2500
SSH_CLIENT=192.168.16.106 49157 22
L3_PARENT_TTY=/dev/pts/0
L3_TAMPERED_EDITORS= vi vim pico nano
SSH_TTY=/dev/pts/0
USER=root
HISTFILESIZE=2500
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAIL=/var/mail/root
L3_SESSION_ID=3214919816900022178-1443510370
PWD=/root
LANG=ru_RU.UTF-8
09:30:50
#export c

09:31:29
#env
SHELL=/bin/bash
TERM=xterm
HISTSIZE=2500
SSH_CLIENT=192.168.16.106 49157 22
L3_PARENT_TTY=/dev/pts/0
OLDPWD=/bin
L3_TAMPERED_EDITORS= vi vim pico nano
SSH_TTY=/dev/pts/0
USER=root
HISTFILESIZE=2500
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAIL=/var/mail/root
L3_SESSION_ID=3214919816900022178-1443510370
PWD=/root
c=10
LANG=ru_RU.UTF-8
09:31:33
#bash
root@debian5:~# echo $c
10
root@debian5:~# exit
exit
09:32:05
#env
SHELL=/bin/bash
TERM=xterm
HISTSIZE=2500
SSH_CLIENT=192.168.16.106 49157 22
L3_PARENT_TTY=/dev/pts/0
OLDPWD=/bin
L3_TAMPERED_EDITORS= vi vim pico nano
SSH_TTY=/dev/pts/0
USER=root
HISTFILESIZE=2500
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAIL=/var/mail/root
L3_SESSION_ID=3214919816900022178-1443510370
PWD=/root
c=10
LANG=ru_RU.UTF-8
09:32:19
#bash
root@debian5:~# PS1='[\u \A]\$ '
[root 10:34]# exit
exit
09:34:46
#test 4 -eq 4

09:40:29
#echo $?
0
09:40:35
#test 4 -eq 5

09:40:43
#echo $?
1
09:40:45
#help test
test: test [expr]
    Evaluate conditional expression.
    Exits with a status of 0 (true) or 1 (false) depending on
    the evaluation of EXPR.  Expressions may be unary or binary.  Unary
    expressions are often used to examine the status of a file.  There
    are string operators and numeric comparison operators as well.
    The behavior of test depends on the number of arguments.  Read the
    bash manual page for the complete specification.
    File operators:
      -a FILE        True if file exists.
...
      arg1 OP arg2   Arithmetic tests.  OP is one of -eq, -ne,
                     -lt, -le, -gt, or -ge.
    Arithmetic binary operators return true if ARG1 is equal, not-equal,
    less-than, less-than-or-equal, greater-than, or greater-than-or-equal
    than ARG2.
    See the bash manual page bash(1) for the handling of parameters (i.e.
    missing parameters).
    Exit Status:
    Returns success if EXPR evaluates to true; fails if EXPR evaluates to
    false or an invalid argument is given.
09:41:31
#ls
23423     234235232252352435  234g23        all     install    report  shell.sh
23423523  234235325           234g23hgfdfh  errors  privet.sh  shadow  wetwet
09:41:55
#ls -l
итого 32
-rw-r--r-- 1 root root    0 Сен 29 10:26 23423
-rw-r--r-- 1 root root    0 Сен 29 10:26 23423523
-rw-r--r-- 1 root root    0 Сен 29 10:26 234235232252352435
-rw-r--r-- 1 root root    0 Сен 29 10:26 234235325
-rw-r--r-- 1 root root    0 Сен 29 10:26 234g23
-rw-r--r-- 1 root root    0 Сен 29 10:26 234g23hgfdfh
-rw-r--r-- 1 root root 2640 Сен 29 11:22 all
-rw-r--r-- 1 root root  348 Сен 29 11:21 errors
-rw-r--r-- 1 root root 5380 Сен 29 14:31 install
-rwxr--r-- 1 root root   40 Сен 29 10:59 privet.sh
-rw-r--r-- 1 root root   36 Сен 29 11:30 report
-rw-r----- 1 root root 1029 Сен 28 14:23 shadow
-rwxr--r-- 1 root root  239 Сен 29 15:21 shell.sh
-rw-r--r-- 1 root root    0 Сен 29 10:26 wetwet
09:41:58
#chmod u-x privet.sh

09:42:28
#test -x privet.sh

09:42:59
#echo $?
1
09:43:05
#test -x shell.sh

09:43:18
#echo $?
0
09:43:19
#[ -x shell.sh ]

09:44:06
#echo $?
0
09:44:09
#help [
[: [ arg... ]
    Evaluate conditional expression.
    This is a synonym for the "test" builtin, but the last argument must
    be a literal `]', to match the opening `['.
[[ ... ]]: [[ expression ]]
    Execute conditional command.
    Returns a status of 0 or 1 depending on the evaluation of the conditional
    expression EXPRESSION.  Expressions are composed of the same primaries used
    by the `test' builtin, and may be combined using the following operators:
      ( EXPRESSION )    Returns the value of EXPRESSION
      ! EXPRESSION              True if EXPRESSION is false; else false
      EXPR1 && EXPR2    True if both EXPR1 and EXPR2 are true; else false
      EXPR1 || EXPR2    True if either EXPR1 or EXPR2 is true; else false
    When the `==' and `!=' operators are used, the string to the right of
    the operator is used as a pattern and pattern matching is performed.
    When the `=~' operator is used, the string to the right of the operator
    is matched as a regular expression.
    The && and || operators do not evaluate EXPR2 if EXPR1 is sufficient to
    determine the expression's value.
    Exit Status:
    0 or 1 depending on value of EXPRESSION.
09:44:45
#help ]
l3script: help: no help topics match `]'.  Try `help help' or `man -k ]' or `info ]'.
09:44:53
#help [
[: [ arg... ]
    Evaluate conditional expression.
    This is a synonym for the "test" builtin, but the last argument must
    be a literal `]', to match the opening `['.
[[ ... ]]: [[ expression ]]
    Execute conditional command.
    Returns a status of 0 or 1 depending on the evaluation of the conditional
    expression EXPRESSION.  Expressions are composed of the same primaries used
    by the `test' builtin, and may be combined using the following operators:
      ( EXPRESSION )    Returns the value of EXPRESSION
      ! EXPRESSION              True if EXPRESSION is false; else false
      EXPR1 && EXPR2    True if both EXPR1 and EXPR2 are true; else false
      EXPR1 || EXPR2    True if either EXPR1 or EXPR2 is true; else false
    When the `==' and `!=' operators are used, the string to the right of
    the operator is used as a pattern and pattern matching is performed.
    When the `=~' operator is used, the string to the right of the operator
    is matched as a regular expression.
    The && and || operators do not evaluate EXPR2 if EXPR1 is sufficient to
    determine the expression's value.
    Exit Status:
    0 or 1 depending on value of EXPRESSION.
09:44:56
#help [
[: [ arg... ]
    Evaluate conditional expression.
    This is a synonym for the "test" builtin, but the last argument must
    be a literal `]', to match the opening `['.
[[ ... ]]: [[ expression ]]
    Execute conditional command.
    Returns a status of 0 or 1 depending on the evaluation of the conditional
    expression EXPRESSION.  Expressions are composed of the same primaries used
    by the `test' builtin, and may be combined using the following operators:
      ( EXPRESSION )    Returns the value of EXPRESSION
      ! EXPRESSION              True if EXPRESSION is false; else false
      EXPR1 && EXPR2    True if both EXPR1 and EXPR2 are true; else false
      EXPR1 || EXPR2    True if either EXPR1 or EXPR2 is true; else false
    When the `==' and `!=' operators are used, the string to the right of
    the operator is used as a pattern and pattern matching is performed.
    When the `=~' operator is used, the string to the right of the operator
    is matched as a regular expression.
    The && and || operators do not evaluate EXPR2 if EXPR1 is sufficient to
    determine the expression's value.
    Exit Status:
    0 or 1 depending on value of EXPRESSION.
09:45:02
#help test
test: test [expr]
    Evaluate conditional expression.
    Exits with a status of 0 (true) or 1 (false) depending on
    the evaluation of EXPR.  Expressions may be unary or binary.  Unary
    expressions are often used to examine the status of a file.  There
    are string operators and numeric comparison operators as well.
    The behavior of test depends on the number of arguments.  Read the
    bash manual page for the complete specification.
    File operators:
      -a FILE        True if file exists.
...
      arg1 OP arg2   Arithmetic tests.  OP is one of -eq, -ne,
                     -lt, -le, -gt, or -ge.
    Arithmetic binary operators return true if ARG1 is equal, not-equal,
    less-than, less-than-or-equal, greater-than, or greater-than-or-equal
    than ARG2.
    See the bash manual page bash(1) for the handling of parameters (i.e.
    missing parameters).
    Exit Status:
    Returns success if EXPR evaluates to true; fails if EXPR evaluates to
    false or an invalid argument is given.
09:45:08
#help
GNU bash, version 4.2.37(1)-release (x86_64-pc-linux-gnu)
These shell commands are defined internally.  Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.
A star (*) next to a name means that the command is disabled.
 job_spec [&]                            history [-c] [-d offset] [n] or hist>
 (( expression ))                        if COMMANDS; then COMMANDS; [ elif C>
 . filename [arguments]                  jobs [-lnprs] [jobspec ...] or jobs >
 :                                       kill [-s sigspec | -n signum | -sigs>
...
 export [-fn] [name[=value] ...] or ex>  typeset [-aAfFgilrtux] [-p] name[=va>
 false                                   ulimit [-SHacdefilmnpqrstuvx] [limit>
 fc [-e ename] [-lnr] [first] [last] o>  umask [-p] [-S] [mode]
 fg [job_spec]                           unalias [-a] name [name ...]
 for NAME [in WORDS ... ] ; do COMMAND>  unset [-f] [-v] [name ...]
 for (( exp1; exp2; exp3 )); do COMMAN>  until COMMANDS; do COMMANDS; done
 function name { COMMANDS ; } or name >  variables - Names and meanings of so>
 getopts optstring name [arg]            wait [id]
 hash [-lr] [-p pathname] [-dt] [name >  while COMMANDS; do COMMANDS; done
 help [-dms] [pattern ...]               { COMMANDS ; }
09:47:28
#help cd
cd: cd [-L|[-P [-e]]] [dir]
    Change the shell working directory.
    Change the current directory to DIR.  The default DIR is the value of the
    HOME shell variable.
    The variable CDPATH defines the search path for the directory containing
    DIR.  Alternative directory names in CDPATH are separated by a colon (:).
    A null directory name is the same as the current directory.  If DIR begins
    with a slash (/), then CDPATH is not used.
    If the directory is not found, and the shell option `cdable_vars' is set,
    the word is assumed to be  a variable name.  If that variable has a value,
    its value is used for DIR.
    Options:
        -L      force symbolic links to be followed
        -P      use the physical directory structure without following symbolic
        links
        -e      if the -P option is supplied, and the current working directory
        cannot be determined successfully, exit with a non-zero status
    The default is to follow symbolic links, as if `-L' were specified.
    Exit Status:
    Returns 0 if the directory is changed, and if $PWD is set successfully when
    -P is used; non-zero otherwise.
09:48:52
#cd --help
l3script: cd: --: неправильная опция
cd: usage: cd [-L|[-P [-e]]] [dir]
09:49:12
#which cd

09:49:39
#which who
/usr/bin/who
09:49:51
#which pwd
/bin/pwd
09:50:06
#which kill
/bin/kill
09:50:14
#ls -ld /var/spool/
drwxr-xr-x 5 root root 4096 Июн 27  2014 /var/spool/
09:51:06
#ls -ld /var/spool/mail
lrwxrwxrwx 1 root root 7 Июн 27  2014 /var/spool/mail -> ../mail
09:51:09
#ls -ld /var/mail
drwxrwsr-x 2 root mail 4096 Сен 29 11:25 /var/mail
09:51:31
#cd /var/spool/mail

09:52:12
#pwd
/var/spool/mail
09:52:21
#/bin/pwd
/var/mail
09:52:55
#pwd -P
/var/mail
09:53:12
#man pwd
09:53:38
#pwd
/var/spool/mail
09:53:40
#echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
09:54:03
#cd

09:54:16
#ls
23423     234235232252352435  234g23        all     install    report  shell.sh
23423523  234235325           234g23hgfdfh  errors  privet.sh  shadow  wetwet
09:54:24
#chmod u+x privet.sh

09:54:41
#pwd
/root
09:54:55
#privet.sh
l3script: privet.sh: команда не найдена
09:55:01
#./privet.sh
Privet !
09:55:06
#PATH=$PATH:/root

09:57:03
#privet.sh
Privet !
09:57:24
#vi /etc/profile
10:01:09
#id -u
0
10:01:12
#id
uid=0(root) gid=0(root) группы=0(root)
10:01:18
#id -u
0
10:01:26
#vi /etc/profile
--- /tmp/l3-saved-7671.1475.20785	2015-09-30 11:01:36.760319809 +0300
+++ /etc/profile	2015-09-30 11:03:08.840319809 +0300
@@ -2,7 +2,7 @@
 # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
 
 if [ "`id -u`" -eq 0 ]; then
-  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root"
 else
   PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
 fi
10:03:08
#exit
exit
Есть приостановленные задачи.
/dev/pts/0
10:03:39
#echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root
10:03:43
#privet.sh ivan
Privet Noname!
10:04:08
#privet.sh
Privet !
10:04:19
#/etc/init.d/
acpid                   killprocs               rcS
bootlogs                kmod                    reboot
bootmisc.sh             motd                    rmnologin
checkfs.sh              mountall-bootclean.sh   rsyslog
checkroot-bootclean.sh  mountall.sh             screen-cleanup
checkroot.sh            mountdevsubfs.sh        sendsigs
console-cyrillic        mountkernfs.sh          single
console-setup           mountnfs-bootclean.sh   ssh
cron                    mountnfs.sh             udev
exim4                   mtab.sh                 udev-mtab
halt                    netdiag                 umountfs
hostname.sh             networking              umountnfs.sh
hwclock.sh              procps                  umountroot
kbd                     rc                      urandom
keyboard-setup          rc.local
10:04:19
#/etc/init.d/rsyslog stop
[ ok ] Stopping enhanced syslogd: rsyslogd.
10:05:54
#service rsyslog start
[ ok ] Starting enhanced syslogd: rsyslogd.
10:06:04
#less /etc/init.d/rsyslog
прошло 11 минут
10:17:24
#chmod u+x test.sh

10:17:31
#./test.sh
123456^C
10:18:16
#./test.sh
1 2 ^C
10:18:18
#chmod u+x test.sh

10:18:19
#./test.sh
1 2 ^C
10:18:23
#vi test.sh
10:19:01
#./test.sh
1 2 3 4 5 6 7 8 9 10
10:19:12
#./test.sh 2 5
1 2 3 4 5
10:19:38
#echo $1

10:20:53
#vi test.sh
--- /tmp/l3-saved-13292.20422.24046	2015-09-30 11:22:12.880319808 +0300
+++ test.sh	2015-09-30 11:23:04.912319822 +0300
@@ -1,4 +1,5 @@
 #!/bin/bash
+echo "You enter $# parameters"
 declare -i i=1
 while [ $i -le ${2:-10} ]
   do
10:23:04
#./test.sh
You enter 0 parameters
1 2 3 4 5 ^C
10:23:13
#./test.sh 3
You enter 1 parameters
1 2 3 ^C
10:23:25
#./test.sh 2 3
You enter 2 parameters
1 2 3
10:23:36
#^C

10:23:36
#vi test.sh
--- /tmp/l3-saved-13292.15070.17925	2015-09-30 11:24:03.992319808 +0300
+++ test.sh	2015-09-30 11:24:18.460319808 +0300
@@ -1,5 +1,7 @@
 #!/bin/bash
 echo "You enter $# parameters"
+echo $*
+echo $0
 declare -i i=1
 while [ $i -le ${2:-10} ]
   do
10:24:18
#./test.sh 2 3
You enter 2 parameters
2 3
./test.sh
1 2 3
10:24:25
#cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
...
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
Debian-exim:x:101:103::/var/spool/exim4:/bin/false
user:x:1000:1000:user,,,:/home/user:/bin/bash
sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin
ivan:x:1001:1001::/home/ivan:/bin/bash
petr:x:1002:1002::/home/petr:/bin/bash
прошло >2 часов
12:54:56
#man pwconv
13:03:17
#useradd -m -n test
useradd: неверный ключ -- «n»
Использование: useradd [параметры] ПОÐ
seradd -D
               useradd -D [параметры]
Параметры:
  -b, --base-dir БАЗ_КАТ        базовый каталог для домашнего каталога новой
                                учётной записи
  -c, --comment КОММЕНТАРИЙ     поле GECOS новой учётной записи
  -d, --home-dir ДОМ_КАТ        домашний каталог новой учётной записи
  -D, --defaults                показать или изменить настройки
...
  -p, --password ПАРОЇётной записи
  -r, --system                  создать системную учётную запись
  -R, --root КАТ_CHROOT         каталог, в который выполняется chroot
  -s, --shell ОБОРновой
                                учётной записи
  -u, --uid UID                 пользовательский ID новой учётной записи
  -U, --user-group              создать группу с тем же именем что и у
                                пользователя
  -Z, --selinux-user SEUSER     использовать указанного SEUSER для
                                пользовательского сопоставления SELinux
13:03:43
#useradd -m -N test

13:03:56
#id test
uid=1003(test) gid=100(users) группы=100(users)
13:04:06
#cat /etc/group
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
...
games:x:60:
users:x:100:
nogroup:x:65534:
libuuid:x:101:
crontab:x:102:
Debian-exim:x:103:
ssh:x:104:
user:x:1000:
ivan:x:1001:
petr:x:1002:
13:04:26
#cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
...
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
Debian-exim:x:101:103::/var/spool/exim4:/bin/false
user:x:1000:1000:user,,,:/home/user:/bin/bash
sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin
ivan:x:1001:1001::/home/ivan:/bin/bash
petr:x:1002:1002::/home/petr:/bin/bash
test:x:1003:100::/home/test:/bin/sh
13:04:30
#apt-get install sudo
Чтение списков пакетов… Готово
Построение дерева зависимостей
Чтение информации о состоянии… Готово
НОВЫЕ пакеты, которые будут установлены:
  sudo
обновлено 0, установлено 1 новых пакетов, для удаления отмечено 0 пакетов, и 66 пакетов не обновлено.
Необходимо скачать 847 kБ архивов.
После данной операции, объём занятого дискового пространства возрастёт на 1 885 kB.
Получено:1 http://ftp.ua.debian.org/debian/ wheezy/main sudo amd64 1.8.5p2-1+nmu3 [847 kB]
Получено 847 kБ за 0с (1 352 kБ/c)
Выбор ранее не выбранного пакета sudo.
(Чтение базы данных … на данный момент установлен 30081 файл и каталог.)
Распаковывается пакет sudo (из файла …/sudo_1.8.5p2-1+nmu3_amd64.deb) …
Обрабатываются триггеры для man-db …
Настраивается пакет sudo (1.8.5p2-1+nmu3) …
13:07:49
#vi /etc/sudoers
--- /tmp/l3-saved-13292.10992.6051	2015-09-30 14:07:55.380319806 +0300
+++ /etc/sudoers	2015-09-30 14:08:51.456319808 +0300
@@ -18,6 +18,7 @@
 
 # User privilege specification
 root	ALL=(ALL:ALL) ALL
+ivan	ALL=(ALL:ALL) ALL
 
 # Allow members of group sudo to execute any command
 %sudo	ALL=(ALL:ALL) ALL
13:08:51
#less /etc/rsyslog.conf
13:10:52
#cat /etc/pa
pam.conf  pam.d/    passwd    passwd-
13:10:52
#cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
...
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
Debian-exim:x:101:103::/var/spool/exim4:/bin/false
user:x:1000:1000:user,,,:/home/user:/bin/bash
sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin
ivan:x:1001:1001::/home/ivan:/bin/bash
petr:x:1002:1002::/home/petr:/bin/bash
test:x:1003:100::/home/test:/bin/sh
anna:x:1004:1004::/home/anna:/bin/sh
13:11:55
#chfn ivan
Изменение информации о пользователе ivan
Введите новое значение или нажмите ENTER для выбора значения по умолчанию
        Полное имя []: Ivan Ivanov
        Номер комнаты []: 9D
        Рабочий телефон []: 101
        Домашний телефон []: 111-11-11
        Другое []:
13:13:58
#cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
...
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
Debian-exim:x:101:103::/var/spool/exim4:/bin/false
user:x:1000:1000:user,,,:/home/user:/bin/bash
sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin
ivan:x:1001:1001:Ivan Ivanov,9D,101,111-11-11:/home/ivan:/bin/bash
petr:x:1002:1002::/home/petr:/bin/bash
test:x:1003:100::/home/test:/bin/sh
anna:x:1004:1004::/home/anna:/bin/sh
13:14:04
#finger
l3script: finger: команда не найдена
13:14:50
#apt-get install finger
Чтение списков пакетов… Готово
Построение дерева зависимостей
Чтение информации о состоянии… Готово
НОВЫЕ пакеты, которые будут установлены:
  finger
обновлено 0, установлено 1 новых пакетов, для удаления отмечено 0 пакетов, и 66 пакетов не обновлено.
Необходимо скачать 20,5 kБ архивов.
После данной операции, объём занятого дискового пространства возрастёт на 31,7 kB.
Получено:1 http://ftp.ua.debian.org/debian/ wheezy/main finger amd64 0.17-15 [20,5 kB]
Получено 20,5 kБ за 0с (145 kБ/c)
Выбор ранее не выбранного пакета finger.
(Чтение базы данных … на данный момент установлено 30150 файлов и каталогов.)
Распаковывается пакет finger (из файла …/finger_0.17-15_amd64.deb) …
Обрабатываются триггеры для man-db …
Настраивается пакет finger (0.17-15) …
13:15:11
#finger ivan
Login: ivan                             Name: Ivan Ivanov
Directory: /home/ivan                   Shell: /bin/bash
Office: 9D, 101                         Home Phone: 111-11-11
On since Tue Sep 29 10:05 (EEST) on pts/2 from 192.168.16.106
   6 minutes 35 seconds idle
Mail last read Tue Sep 29 11:26 2015 (EEST)
No Plan.
13:15:55
#cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
...
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
Debian-exim:x:101:103::/var/spool/exim4:/bin/false
user:x:1000:1000:user,,,:/home/user:/bin/bash
sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin
ivan:x:1001:1001:Ivan Ivanov,9D,101,111-11-11:/home/ivan:/bin/bash
petr:x:1002:1002::/home/petr:/bin/bash
test:x:1003:100::/home/test:/bin/sh
anna:x:1004:1004::/home/anna:/bin/sh
13:17:46
#cat /etc/default/useradd
# Default values for useradd(8)
#
# The SHELL variable specifies the default login shell on your
# system.
# Similar to DHSELL in adduser. However, we use "sh" here because
# useradd is a low level utility and should be as general
# as possible
SHELL=/bin/sh
#
# The default group for users
...
# EXPIRE=
#
# The SKEL variable specifies the directory containing "skeletal" user
# files; in other words, files such as a sample .profile that will be
# copied to the new user's home directory when it is created.
# SKEL=/etc/skel
#
# Defines whether the mail spool should be created while
# creating the account
# CREATE_MAIL_SPOOL=yes
13:18:34
#useradd
Использование: useradd [параметры] ПОÐ
seradd -D
               useradd -D [параметры]
Параметры:
  -b, --base-dir БАЗ_КАТ        базовый каталог для домашнего каталога новой
                                учётной записи
  -c, --comment КОММЕНТАРИЙ     поле GECOS новой учётной записи
  -d, --home-dir ДОМ_КАТ        домашний каталог новой учётной записи
  -D, --defaults                показать или изменить настройки
                                по умолчанию для useradd
...
  -p, --password ПАРОЇётной записи
  -r, --system                  создать системную учётную запись
  -R, --root КАТ_CHROOT         каталог, в который выполняется chroot
  -s, --shell ОБОРновой
                                учётной записи
  -u, --uid UID                 пользовательский ID новой учётной записи
  -U, --user-group              создать группу с тем же именем что и у
                                пользователя
  -Z, --selinux-user SEUSER     использовать указанного SEUSER для
                                пользовательского сопоставления SELinux
13:20:00
#cat /etc/default/useradd
# Default values for useradd(8)
#
# The SHELL variable specifies the default login shell on your
# system.
# Similar to DHSELL in adduser. However, we use "sh" here because
# useradd is a low level utility and should be as general
# as possible
SHELL=/bin/bash
#
# The default group for users
...
#
# Defines whether the mail spool should be created while
# creating the account
# CREATE_MAIL_SPOOL=yes
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SKEL=/etc/skel
CREATE_MAIL_SPOOL=no

Файлы

  • /etc/default/useradd
  • /etc/group
  • /etc/pa
  • /etc/passwd
  • /etc/default/useradd
    >
    # Default values for useradd(8)
    #
    # The SHELL variable specifies the default login shell on your
    # system.
    # Similar to DHSELL in adduser. However, we use "sh" here because
    # useradd is a low level utility and should be as general
    # as possible
    SHELL=/bin/bash
    #
    # The default group for users
    # 100=users on Debian systems
    # Same as USERS_GID in adduser
    # This argument is used when the -n flag is specified.
    # The default behavior (when -n and -g are not specified) is to create a
    # primary user group with the same name as the user being added to the
    # system.
    # GROUP=100
    #
    # The default home directory. Same as DHOME for adduser
    # HOME=/home
    #
    # The number of days after a password expires until the account
    # is permanently disabled
    # INACTIVE=-1
    #
    # The default expire date
    # EXPIRE=
    #
    # The SKEL variable specifies the directory containing "skeletal" user
    # files; in other words, files such as a sample .profile that will be
    # copied to the new user's home directory when it is created.
    # SKEL=/etc/skel
    #
    # Defines whether the mail spool should be created while
    # creating the account
    # CREATE_MAIL_SPOOL=yes
    GROUP=100
    HOME=/home
    INACTIVE=-1
    EXPIRE=
    SKEL=/etc/skel
    CREATE_MAIL_SPOOL=no
    
    /etc/group
    >
    root:x:0:
    daemon:x:1:
    bin:x:2:
    sys:x:3:
    adm:x:4:
    tty:x:5:
    disk:x:6:
    lp:x:7:
    mail:x:8:
    news:x:9:
    uucp:x:10:
    man:x:12:
    proxy:x:13:
    kmem:x:15:
    dialout:x:20:
    fax:x:21:
    voice:x:22:
    cdrom:x:24:user
    floppy:x:25:user
    tape:x:26:
    sudo:x:27:
    audio:x:29:user
    dip:x:30:user
    www-data:x:33:
    backup:x:34:
    operator:x:37:
    list:x:38:
    irc:x:39:
    src:x:40:
    gnats:x:41:
    shadow:x:42:
    utmp:x:43:
    video:x:44:user
    sasl:x:45:
    plugdev:x:46:user
    staff:x:50:
    games:x:60:
    users:x:100:
    nogroup:x:65534:
    libuuid:x:101:
    crontab:x:102:
    Debian-exim:x:103:
    ssh:x:104:
    user:x:1000:
    ivan:x:1001:
    petr:x:1002:
    
    /etc/pa
    >
    pam.conf  pam.d/    passwd    passwd-
    
    /etc/passwd
    >
    root:x:0:0:root:/root:/bin/bash
    daemon:x:1:1:daemon:/usr/sbin:/bin/sh
    bin:x:2:2:bin:/bin:/bin/sh
    sys:x:3:3:sys:/dev:/bin/sh
    sync:x:4:65534:sync:/bin:/bin/sync
    games:x:5:60:games:/usr/games:/bin/sh
    man:x:6:12:man:/var/cache/man:/bin/sh
    lp:x:7:7:lp:/var/spool/lpd:/bin/sh
    mail:x:8:8:mail:/var/mail:/bin/sh
    news:x:9:9:news:/var/spool/news:/bin/sh
    uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
    proxy:x:13:13:proxy:/bin:/bin/sh
    www-data:x:33:33:www-data:/var/www:/bin/sh
    backup:x:34:34:backup:/var/backups:/bin/sh
    list:x:38:38:Mailing List Manager:/var/list:/bin/sh
    irc:x:39:39:ircd:/var/run/ircd:/bin/sh
    gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
    nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
    libuuid:x:100:101::/var/lib/libuuid:/bin/sh
    Debian-exim:x:101:103::/var/spool/exim4:/bin/false
    user:x:1000:1000:user,,,:/home/user:/bin/bash
    sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin
    ivan:x:1001:1001:Ivan Ivanov,9D,101,111-11-11:/home/ivan:/bin/bash
    petr:x:1002:1002::/home/petr:/bin/bash
    test:x:1003:100::/home/test:/bin/sh
    anna:x:1004:1004::/home/anna:/bin/sh
    

    Статистика

    Время первой команды журнала09:30:16 2015- 9-30
    Время последней команды журнала13:20:00 2015- 9-30
    Количество командных строк в журнале101
    Процент команд с ненулевым кодом завершения, % 7.92
    Процент синтаксически неверно набранных команд, % 1.98
    Суммарное время работы с терминалом *, час 1.32
    Количество командных строк в единицу времени, команда/мин 1.27
    Частота использования команд
    test.sh9|========| 8.82%
    cat9|========| 8.82%
    echo8|=======| 7.84%
    help8|=======| 7.84%
    vi6|=====| 5.88%
    ls6|=====| 5.88%
    pwd5|====| 4.90%
    privet.sh5|====| 4.90%
    chmod4|===| 3.92%
    id4|===| 3.92%
    which4|===| 3.92%
    test4|===| 3.92%
    env3|==| 2.94%
    useradd3|==| 2.94%
    cd3|==| 2.94%
    man2|=| 1.96%
    finger2|=| 1.96%
    less2|=| 1.96%
    bash2|=| 1.96%
    apt-get2|=| 1.96%
    service1|| 0.98%
    chfn1|| 0.98%
    set1|| 0.98%
    /etc/init.d/1|| 0.98%
    root1|| 0.98%
    [1|| 0.98%
    export1|| 0.98%
    grep1|| 0.98%
    ^C1|| 0.98%
    exit1|| 0.98%
    /etc/init.d/rsyslog1|| 0.98%
    ____
    *) Интервалы неактивности длительностью 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$