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

Содержание

Журнал

Понедельник (07/16/18)

/dev/pts/0
09:05:36
#ls
install
09:06:47
#useradd ivan

09:15:06
#echo $?
0
09:16:23
#useradd ivan
useradd: пользователь «ivan» уже существует
09:19:42
#echo $?
9
09:19:47
#useradd --help
Использование: 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
09:21:01
#LANG=''

09:23:50
#useradd --help
Usage: useradd [options] LOGIN
       useradd -D
       useradd -D [options]
Options:
  -b, --base-dir BASE_DIR       base directory for the home directory of the
                                new account
  -c, --comment COMMENT         GECOS field of the new account
  -d, --home-dir HOME_DIR       home directory of the new account
  -D, --defaults                print or change default useradd configuration
  -e, --expiredate EXPIRE_DATE  expiration date of the new account
...
                                the user
  -o, --non-unique              allow to create users with duplicate
                                (non-unique) UID
  -p, --password PASSWORD       encrypted password of the new account
  -r, --system                  create a system account
  -R, --root CHROOT_DIR         directory to chroot into
  -s, --shell SHELL             login shell of the new account
  -u, --uid UID                 user ID of the new account
  -U, --user-group              create a group with the same name as the user
  -Z, --selinux-user SEUSER     use a specific SEUSER for the SELinux user mapping
09:23:52
#man useradd
09:28:19
#passwd ivan
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
09:30:21
#userdel ivan

09:34:46
#echo $?
0
09:34:52
#useradd -m -s /bin/bash ivan

09:39:57
#passwd ivan
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
09:41:36
#useradd -m -s /bin/bash petr

09:44:14
#passwd petr
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
09:44:45
#who
root     pts/0        Jul 16 09:55 (192.168.15.128)
ivan     pts/2        Jul 16 10:41 (192.168.15.128)
petr     pts/3        Jul 16 10:44 (192.168.15.128)
09:45:26
#cd /

прошло 14 минут
09:59:43
#ls
bin  boot  dev  etc  home  initrd.img  lib  lib32  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  selinux  srv  sys  tmp  usr  var  vmlinuz
09:59:54
#ls -l
total 84
drwxr-xr-x  2 root root  4096 Oct 13  2014 bin
drwxr-xr-x  3 root root  4096 Oct 13  2014 boot
drwxr-xr-x 12 root root  2960 Jul 16 08:39 dev
drwxr-xr-x 68 root root  4096 Jul 16 10:44 etc
drwxr-xr-x  5 root root  4096 Jul 16 10:44 home
lrwxrwxrwx  1 root root    30 Jun 27  2014 initrd.img -> /boot/initrd.img-3.2.0-4-amd64
drwxr-xr-x 13 root root  4096 Oct 15  2014 lib
drwxr-xr-x  2 root root  4096 Oct 15  2014 lib32
drwxr-xr-x  2 root root  4096 Oct 13  2014 lib64
...
drwx------  5 root root  4096 Jul 16 09:59 root
drwxr-xr-x 12 root root   420 Jul 16 08:39 run
drwxr-xr-x  2 root root  4096 Oct 13  2014 sbin
drwxr-xr-x  2 root root  4096 Jun 10  2012 selinux
drwxr-xr-x  2 root root  4096 Jun 27  2014 srv
drwxr-xr-x 13 root root     0 Jul 16 08:39 sys
drwxrwxrwt  2 root root  4096 Jul 16 10:51 tmp
drwxr-xr-x 11 root root  4096 Oct 15  2014 usr
drwxr-xr-x 11 root root  4096 Jun 27  2014 var
lrwxrwxrwx  1 root root    26 Jun 27  2014 vmlinuz -> boot/vmlinuz-3.2.0-4-amd64
10:00:00
#cd ivan
l3script: cd: ivan: No such file or directory
10:00:26
#cd root/

10:00:34
#cd //

10:00:53
#ls
bin  boot  dev  etc  home  initrd.img  lib  lib32  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  selinux  srv  sys  tmp  usr  var  vmlinuz
10:00:59
#ls /
bin  boot  dev  etc  home  initrd.img  lib  lib32  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  selinux  srv  sys  tmp  usr  var  vmlinuz
10:01:05
#cd /

10:01:11
#cd home/

10:01:15
#ls
ivan  petr  user
10:01:17
#cd ivan/

10:01:33
#cd /

10:01:46
#cd

10:02:23
#cd /

прошло 23 минуты
10:26:05
#ls -l
total 84
drwxr-xr-x  2 root root  4096 Oct 13  2014 bin
drwxr-xr-x  3 root root  4096 Oct 13  2014 boot
drwxr-xr-x 12 root root  2960 Jul 16 08:39 dev
drwxr-xr-x 68 root root  4096 Jul 16 10:44 etc
drwxr-xr-x  5 root root  4096 Jul 16 10:44 home
lrwxrwxrwx  1 root root    30 Jun 27  2014 initrd.img -> /boot/initrd.img-3.2.0-4-amd64
drwxr-xr-x 13 root root  4096 Oct 15  2014 lib
drwxr-xr-x  2 root root  4096 Oct 15  2014 lib32
drwxr-xr-x  2 root root  4096 Oct 13  2014 lib64
...
drwx------  5 root root  4096 Jul 16 09:59 root
drwxr-xr-x 12 root root   420 Jul 16 08:39 run
drwxr-xr-x  2 root root  4096 Oct 13  2014 sbin
drwxr-xr-x  2 root root  4096 Jun 10  2012 selinux
drwxr-xr-x  2 root root  4096 Jun 27  2014 srv
drwxr-xr-x 13 root root     0 Jul 16 08:39 sys
drwxrwxrwt  2 root root  4096 Jul 16 11:17 tmp
drwxr-xr-x 11 root root  4096 Oct 15  2014 usr
drwxr-xr-x 11 root root  4096 Jun 27  2014 var
lrwxrwxrwx  1 root root    26 Jun 27  2014 vmlinuz -> boot/vmlinuz-3.2.0-4-amd64
10:26:08
#cd

10:26:28
#ls -l
total 8
-rw-r--r-- 1 root root 5268 Oct 13  2014 install
10:26:33
#ls -la
total 56
drwx------  5 root root 4096 Jul 16 09:59 .
drwxr-xr-x 24 root root 4096 Oct 15  2014 ..
drwx------  2 root root 4096 Jun 27  2014 .aptitude
-rw-------  1 root root 1896 Oct 15  2014 .bash_history
-rw-r--r--  1 root root   10 Jun 27  2014 .bash_profile
-rw-r--r--  1 root root  630 Jun 27  2014 .bashrc
-rw-r--r--  1 root root   51 Jul 13 14:52 .l3rc
drwxr-xr-x  2 root root 4096 Jul 16 10:05 .lilalo
-rw-r--r--  1 root root  140 Nov 19  2007 .profile
drwxr-xr-x  2 root root 4096 Jun 27  2014 .vim
-rw-------  1 root root 5390 Jul 16 09:59 .viminfo
-rw-r--r--  1 root root 5268 Oct 13  2014 install
10:28:38
#ls -la --color
total 56
drwx------  5 root root 4096 Jul 16 09:59 .
drwxr-xr-x 24 root root 4096 Oct 15  2014 ..
drwx------  2 root root 4096 Jun 27  2014 .aptitude
-rw-------  1 root root 1896 Oct 15  2014 .bash_history
-rw-r--r--  1 root root   10 Jun 27  2014 .bash_profile
-rw-r--r--  1 root root  630 Jun 27  2014 .bashrc
-rw-r--r--  1 root root   51 Jul 13 14:52 .l3rc
drwxr-xr-x  2 root root 4096 Jul 16 10:05 .lilalo
-rw-r--r--  1 root root  140 Nov 19  2007 .profile
drwxr-xr-x  2 root root 4096 Jun 27  2014 .vim
-rw-------  1 root root 5390 Jul 16 09:59 .viminfo
-rw-r--r--  1 root root 5268 Oct 13  2014 install
10:32:21
#alias ls='ls --color'

10:33:39
#ls
install
10:33:40
#ls -la
total 56
drwx------  5 root root 4096 Jul 16 09:59 .
drwxr-xr-x 24 root root 4096 Oct 15  2014 ..
drwx------  2 root root 4096 Jun 27  2014 .aptitude
-rw-------  1 root root 1896 Oct 15  2014 .bash_history
-rw-r--r--  1 root root   10 Jun 27  2014 .bash_profile
-rw-r--r--  1 root root  630 Jun 27  2014 .bashrc
-rw-r--r--  1 root root   51 Jul 13 14:52 .l3rc
drwxr-xr-x  2 root root 4096 Jul 16 10:05 .lilalo
-rw-r--r--  1 root root  140 Nov 19  2007 .profile
drwxr-xr-x  2 root root 4096 Jun 27  2014 .vim
-rw-------  1 root root 5390 Jul 16 09:59 .viminfo
-rw-r--r--  1 root root 5268 Oct 13  2014 install
10:33:45
#alias
alias ls='ls --color'
10:35:04
#ls -la /dev/
total 4
drwxr-xr-x 12 root root        2960 Jul 16 08:39 .
drwxr-xr-x 24 root root        4096 Oct 15  2014 ..
lrwxrwxrwx  1 root root           9 Jul 16 08:39 MAKEDEV -> /bin/true
crw------T  1 root root     10, 235 Jul 16 08:39 autofs
drwxr-xr-x  2 root root         280 Jul 16 08:39 block
drwxr-xr-x  2 root root          60 Jul 16 08:39 bsg
crw------T  1 root root     10, 234 Jul 16 08:39 btrfs-control
lrwxrwxrwx  1 root root           3 Jul 16 08:39 cdrom1 -> sr0
drwxr-xr-x  2 root root        2320 Jul 16 08:39 char
...
crw-------  1 root root      7, 131 Jul 16 08:39 vcsa3
crw-------  1 root root      7, 132 Jul 16 08:39 vcsa4
crw-------  1 root root      7, 133 Jul 16 08:39 vcsa5
crw-------  1 root root      7, 134 Jul 16 08:39 vcsa6
crw-------  1 root root     10,  63 Jul 16 08:39 vga_arbiter
prw-r-----  1 root adm            0 Jul 16 11:17 xconsole
brw-rw---T  1 root disk    202,   0 Jul 16 08:39 xvda
brw-rw---T  1 root disk    202,   1 Jul 16 08:39 xvda1
brw-rw---T  1 root disk    202,  16 Jul 16 08:39 xvdb
crw-rw-rw-  1 root root      1,   5 Jul 16 08:39 zero
прошло 11 минут
10:46:58
#who
root     pts/0        Jul 16 09:55 (192.168.15.128)
ivan     pts/2        Jul 16 10:41 (192.168.15.128)
petr     pts/3        Jul 16 10:44 (192.168.15.128)
user     pts/4        Jul 16 10:51 (192.168.15.128)
10:47:00
#echo privet > /dev/pt
ptmx  pts/
10:47:00
#echo privet > /dev/pts/2

10:47:49
#mailq

10:50:07
#which who
/usr/bin/who
10:51:16
#which mailq
/usr/bin/mailq
10:52:02
#ls -l /usr/bin/who
-rwxr-xr-x 1 root root 55888 Jan 26  2013 /usr/bin/who
10:52:22
#ls -l /usr/bin/mail
mail            mail-lock       mail-touchlock  mail-unlock     mailq           mailx
10:52:22
#ls -l /usr/bin/mailq
lrwxrwxrwx 1 root root 13 Jan  2  2013 /usr/bin/mailq -> ../sbin/exim4
10:53:19
#ls -l /usr/sbin/exim4
-rwsr-xr-x 1 root root 973824 Jan  2  2013 /usr/sbin/exim4
10:54:16
#ls -l /dev/cdrom1
lrwxrwxrwx 1 root root 3 Jul 16 08:39 /dev/cdrom1 -> sr0
10:57:00
#ls -l /dev/sr0
brw-rw---T 1 root cdrom 11, 0 Jul 16 08:39 /dev/sr0
10:57:30
#mkfifo /tmp/test

11:02:54
#echo $?
0
11:03:08
#ls -l /tmp/test
prw-r--r-- 1 root root 0 Jul 16 12:02 /tmp/test
11:03:23
#echo prive > /tmp/test

11:04:48
#ls -l /dev/log
srw-rw-rw- 1 root root 0 Jul 16 08:39 /dev/log
11:06:43
#netstat
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 debian2.net.nt:ssh      192.168.15.128:49323    ESTABLISHED
tcp        0    432 debian2.net.nt:ssh      192.168.15.128:49242    ESTABLISHED
tcp        0      0 debian2.net.nt:ssh      192.168.15.128:49322    ESTABLISHED
tcp        0      0 debian2.net.nt:ssh      192.168.15.128:49312    ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  7      [ ]         DGRAM                    5058     /dev/log
unix  3      [ ]         STREAM     CONNECTED     7098
...
unix  3      [ ]         STREAM     CONNECTED     6904
unix  3      [ ]         STREAM     CONNECTED     6903
unix  2      [ ]         DGRAM                    6902
unix  3      [ ]         STREAM     CONNECTED     6723
unix  3      [ ]         STREAM     CONNECTED     6722
unix  2      [ ]         DGRAM                    6721
unix  2      [ ]         DGRAM                    5486
unix  2      [ ]         DGRAM                    5098
unix  3      [ ]         DGRAM                    3254
unix  3      [ ]         DGRAM                    3253
11:09:35
#cd /
bin/        dev/        home/       lib/        lib64/      media/      opt/        root/       sbin/       srv/        tmp/        var/
boot/       etc/        initrd.img  lib32/      lost+found/ mnt/        proc/       run/        selinux/    sys/        usr/        vmlinuz
11:09:35
#cd /home/ivan/

11:12:39
#cd /home/petr/

11:12:49
#cd -
/home/ivan
11:13:02
#apt-get install tree
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  tree
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 43.3 kB of archives.
After this operation, 112 kB of additional disk space will be used.
Get:1 http://ftp.ua.debian.org/debian/ wheezy/main tree amd64 1.6.0-1 [43.3 kB]
Fetched 43.3 kB in 0s (320 kB/s)
Selecting previously unselected package tree.
(Reading database ... 28835 files and directories currently installed.)
Unpacking tree (from .../tree_1.6.0-1_amd64.deb) ...
Processing triggers for man-db ...
Setting up tree (1.6.0-1) ...
прошло 25 минут
11:39:01
#cd

прошло 63 минуты
12:42:11
#cat install
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"}  # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
step "Installing perl modules for l3-agent" '{ for i in ${perl_modules}; do tar xvfz $i.tar.gz; cd $i*[^z]; perl Makefile.PL; make; make install; cd ..; done; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
12:42:16
#more install
12:43:26
#less install
12:45:25
#tail install
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
step "Installing perl modules for l3-agent" '{ for i in ${perl_modules}; do tar xvfz $i.tar.gz; cd $i*[^z]; perl Makefile.PL; make; make install; cd ..; done; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
12:48:28
#tac install
show_final_message
rm -rf ${temp_dir}
cd /
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Installing perl modules for l3-agent" '{ for i in ${perl_modules}; do tar xvfz $i.tar.gz; cd $i*[^z]; perl Makefile.PL; make; make install; cd ..; done; }'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading l3prompt" ${wget} ${url_l3prompt}
...
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
install_l3bashrc_for_this_users=${users:-"root user"}  # users who will use l3agent and l3script
lab=NT-LNet
lilalo_user=13-10-2014
# Set this variables before installation:
#
###############################################################################
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
hostname=`hostname`
#!/bin/sh
12:52:19
#ln install install2

13:00:52
#ls -l
total 16
-rw-r--r-- 2 root root 5268 Oct 13  2014 install
-rw-r--r-- 2 root root 5268 Oct 13  2014 install2
13:01:03
#history
    1  ifconfig
    2  vim /etc/network/interfaces
    3  nano /etc/network/interfaces
    4  /etc/init.d/networking restart
    5  ifconfig
    6  route
    7  ping 192.168.13.253
    8  shutdown -r now
    9  exit
   10  ping ya.ru
...
  172  apt-get install tree
  173  cd
  174  cat install
  175  more install
  176    less install
  177  tail install
  178  tac install
  179  ln install install2
  180  ls -l
  181  history
прошло 39 минут
13:40:59
#man cp
прошло 37 минут
14:18:25
#cp install test

14:20:41
#ls
install  install2  test
14:20:44
#which vi
/usr/bin/vi
14:21:36
#which vim
/usr/bin/vim
14:21:39
#ls -l /usr/bin/vi
lrwxrwxrwx 1 root root 20 Jun 27  2014 /usr/bin/vi -> /etc/alternatives/vi
14:22:06
#ls -l /etc/alternatives/vi
lrwxrwxrwx 1 root root 18 Jun 27  2014 /etc/alternatives/vi -> /usr/bin/vim.basic
14:22:37
#ls -l /usr/bin/vim
vim        vim.basic  vim.tiny   vimdiff    vimtutor
14:22:37
#ls -l /usr/bin/vim.basic
-rwxr-xr-x 1 root root 1876072 Feb 10  2013 /usr/bin/vim.basic
14:23:01