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

Содержание

Журнал

Среда (10/17/18)

/dev/pts/5
15:21:23
#ls /tmp/
07856  23454567  23456   344757  34523534  35347647  3656876  4564764  458     54589  etccopy
12312  2345575   235345  34523   3453422   35457     45646    4567     478699  79780  test
/dev/pts/0
15:21:24
#cd /tmp/

/dev/pts/5
15:21:24
#cd /tmp/

/dev/pts/0
15:22:40
#find . -name '[0-9]*' -type f -maxdepth 1 | rm
rm: missing operand
Try `rm --help' for more information.
find: warning: you have specified the -maxdepth option after a non-option argument -name, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.
/dev/pts/5
15:22:40
#find . -name '[0-9]*' -type f -maxdepth 1 | rm
rm: missing operand
Try `rm --help' for more information.
find: warning: you have specified the -maxdepth option after a non-option argument -name, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.
/dev/pts/0
15:23:07
#find . -name '[0-9]*' -type f -maxdepth 1 | xargs rm
find: warning: you have specified the -maxdepth option after a non-option argument -name, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.
/dev/pts/5
15:23:07
#find . -name '[0-9]*' -type f -maxdepth 1 | xargs rm
find: warning: you have specified the -maxdepth option after a non-option argument -name, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.
/dev/pts/0
15:24:29
#ls
etccopy  test
/dev/pts/5
15:24:29
#ls
etccopy  test

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

/dev/pts/0
07:55:57
#cat 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
прошло 46 минут
08:41:58
#vi shell.sh
--- /dev/null	2018-10-14 20:49:23.819999998 +0300
+++ shell.sh	2018-10-18 09:50:40.467757841 +0300
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+users=$(awkv -F: '$3>=1000 && $3!=65534{print $1}' /etc/passwd)
+echo $users
08:50:40
#chmod u+x shell.sh

08:53:20
#ls -l
total 28
drwxr-xr-x 2 root root 4096 Oct 16 12:41 d1
drwxr-xr-x 3 root root 4096 Oct 16 12:46 d2
-rw-r--r-- 1 root root 5268 Oct 16 16:38 install
-rw-r--r-- 1 root root  189 Oct 17 13:49 ip
-rw-r--r-- 1 root root  986 Oct 17 14:28 passwd
-rwxr--r-- 1 root root   89 Oct 18 09:50 shell.sh
08:53:48
#PATH=$PATH:/root

08:56:55
#echo $PASS

08:57:02
#echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root
08:57:10
#shell.sh
/root/shell.sh: line 3: awkv: command not found
08:57:20
#vi shell.sh
--- /tmp/l3-saved-10043.11866.22124	2018-10-18 09:57:29.631750151 +0300
+++ shell.sh	2018-10-18 09:57:38.771746098 +0300
@@ -1,4 +1,4 @@
 #!/bin/bash
 
-users=$(awkv -F: '$3>=1000 && $3!=65534{print $1}' /etc/passwd)
+users=$(awk -F: '$3>=1000 && $3!=65534{print $1}' /etc/passwd)
 echo $users
08:57:38
#shell.sh
user ivan petr
08:57:40
#vi shell.sh
--- /tmp/l3-saved-10043.29606.9502	2018-10-18 09:57:56.471728094 +0300
+++ shell.sh	2018-10-18 10:04:15.435765142 +0300
@@ -1,4 +1,8 @@
 #!/bin/bash
 
 users=$(awk -F: '$3>=1000 && $3!=65534{print $1}' /etc/passwd)
-echo $users
+
+for user in $users
+do
+	usermod -s /bin/$1 $user
+done
09:04:15
#shell.sh sh

09:04:21
#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/sh
sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin
ivan:x:1001:1001::/home/ivan:/bin/sh
petr:x:1002:1002::/home/petr:/bin/sh
09:04:43
#vi shell.sh
--- /tmp/l3-saved-10043.31492.30700	2018-10-18 10:05:06.231740743 +0300
+++ shell.sh	2018-10-18 10:06:28.199744507 +0300
@@ -4,5 +4,6 @@
 
 for user in $users
 do
+	echo "Change shell $1 for user $user. "
 	usermod -s /bin/$1 $user
 done
09:06:28
#shell.sh bash
Change shell bash for user user.
Change shell bash for user ivan.
Change shell bash for user petr.
09:06:38
#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
09:07:13
#vi shell.sh
--- /tmp/l3-saved-10043.19303.3822	2018-10-18 10:07:51.259793062 +0300
+++ shell.sh	2018-10-18 10:11:41.955731112 +0300
@@ -1,9 +1,11 @@
 #!/bin/bash
 
+shell=${1:-bash}
+
 users=$(awk -F: '$3>=1000 && $3!=65534{print $1}' /etc/passwd)
 
 for user in $users
 do
-	echo "Change shell $1 for user $user. "
+	echo "Change shell $shell for user $user. "
 	usermod -s /bin/$1 $user
 done
09:11:42
#shell.sh sh
Change shell sh for user user.
Change shell sh for user ivan.
Change shell sh for user petr.
09:11:54
#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/sh
sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin
ivan:x:1001:1001::/home/ivan:/bin/sh
petr:x:1002:1002::/home/petr:/bin/sh
09:11:57
#shell.sh
Change shell bash for user user.
Change shell bash for user ivan.
Change shell bash for user petr.
09:12:03
#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/
sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin
ivan:x:1001:1001::/home/ivan:/bin/
petr:x:1002:1002::/home/petr:/bin/
09:12:04
#vi shell.sh
09:12:49
#~
Change shell bash for user user.
usermod: no changes
Change shell bash for user ivan.
usermod: no changes
Change shell bash for user petr.
usermod: no changes
09:12:57
#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/
sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin
ivan:x:1001:1001::/home/ivan:/bin/
petr:x:1002:1002::/home/petr:/bin/
09:13:00
#vi shell.sh
--- /tmp/l3-saved-10043.16466.25837	2018-10-18 10:13:04.247734555 +0300
+++ shell.sh	2018-10-18 10:13:29.655740759 +0300
@@ -7,5 +7,5 @@
 for user in $users
 do
 	echo "Change shell $shell for user $user. "
-	usermod -s /bin/$1 $user
+	usermod -s /bin/$shell $user
 done
09:13:29
#vi shell.sh
09:13:34
#~
Change shell bash for user user.
Change shell bash for user ivan.
Change shell bash for user petr.
09:13:38
#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
09:13:41
#PS1='[\u@\h-\A-\w]\$ '
[root@debian2-10:18-~]# PS1='[\u@\h-|A-\w]\$ '
[root@debian2-|A-~]# PS1='[\u@\h-\A|\w]\$ '
[root@debian2-10:19|~]# cd /etc/
[root@debian2-10:20|/etc]# PS1='[\u@\h-\A|\w]\$ '
[root@debian2-10:20|/etc]#  sleep 500
^C
[root@debian2-10:51|/etc]#  sleep 500 &
[1] 10629
[root@debian2-10:51|/etc]# jobs
[1]+  Running                 sleep 500 &
...
[root@debian2-10:54|/etc]# bg %1
[1]+ sleep 1000 &
[root@debian2-10:55|/etc]# jobs
[1]+  Running                 sleep 1000 &
[root@debian2-10:55|/etc]# l3s
l3script: l3s: command not found
[1]+  Done                    sleep 1000
[root@debian2-12:23|/etc]# l3s
l3script  l3shot
[root@debian2-12:23|/etc]# l3script
прошло >2 часов
11:23:41
#ssh 192.168.13.5
The authenticity of host '192.168.13.5 (192.168.13.5)' can't be established.
ECDSA key fingerprint is bb:7b:f3:72:0e:3d:91:4c:a0:5b:88:ff:0d:0d:33:1d.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '192.168.13.5' (ECDSA) to the list of known hosts.
root@192.168.13.5's password:
Linux debian5 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64
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.
...
C.C  file.C  file.Cs  rn
root@debian5:/home/user/sh# cp C.C 192.168.13.2/home/user/sh
cp: невозможно создать обычный файл «192.168.13.2/home/user/sh»: Нет такого файла или каталога
root@debian5:/home/user/sh# cp C.C //192.168.13.2/home/user/sh
cp: невозможно создать обычный файл «//192.168.13.2/home/user/sh»: Нет такого файла или каталога
root@debian5:/home/user/sh# cp C.C 192.168.13.2/home/user/sh
cp: невозможно создать обычный файл «192.168.13.2/home/user/sh»: Нет такого файла или каталога
root@debian5:/home/user/sh# exit
logout
Connection to 192.168.13.5 closed.
/dev/pts/1
11:23:41
#ssh 192.168.13.5
The authenticity of host '192.168.13.5 (192.168.13.5)' can't be established.
ECDSA key fingerprint is bb:7b:f3:72:0e:3d:91:4c:a0:5b:88:ff:0d:0d:33:1d.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '192.168.13.5' (ECDSA) to the list of known hosts.
root@192.168.13.5's password:
Linux debian5 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64
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.
...
C.C  file.C  file.Cs  rn
root@debian5:/home/user/sh# cp C.C 192.168.13.2/home/user/sh
cp: невозможно создать обычный файл «192.168.13.2/home/user/sh»: Нет такого файла или каталога
root@debian5:/home/user/sh# cp C.C //192.168.13.2/home/user/sh
cp: невозможно создать обычный файл «//192.168.13.2/home/user/sh»: Нет такого файла или каталога
root@debian5:/home/user/sh# cp C.C 192.168.13.2/home/user/sh
cp: невозможно создать обычный файл «192.168.13.2/home/user/sh»: Нет такого файла или каталога
root@debian5:/home/user/sh# exit
logout
Connection to 192.168.13.5 closed.
прошло 22 минуты
/dev/pts/0
11:45:43
#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
/dev/pts/1
11:45:43
#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
прошло 72 минуты
/dev/pts/0
12:58:02
#chfn ivan
Changing the user information for ivan
Enter the new value, or press ENTER for the default
        Full Name []: Ivan Ivanov
        Room Number []: 9c
        Work Phone []: 0441234567
        Home Phone []: 0447654321
        Other []: Kiev
/dev/pts/1
12:58:02
#chfn ivan
Changing the user information for ivan
Enter the new value, or press ENTER for the default
        Full Name []: Ivan Ivanov
        Room Number []: 9c
        Work Phone []: 0441234567
        Home Phone []: 0447654321
        Other []: Kiev
прошло 17 минут
/dev/pts/0
13:15:37
#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:Ivan Ivanov,9c,0441234567,0447654321,Kiev:/home/ivan:/bin/bash
petr:x:1002:1002::/home/petr:/bin/bash
/dev/pts/1
13:15:37
#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:Ivan Ivanov,9c,0441234567,0447654321,Kiev:/home/ivan:/bin/bash
petr:x:1002:1002::/home/petr:/bin/bash
/dev/pts/0
13:15:42
#apt-get install finger
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  finger
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 20.5 kB of archives.
After this operation, 31.7 kB of additional disk space will be used.
Get:1 http://ftp.ua.debian.org/debian/ wheezy/main finger amd64 0.17-15 [20.5 kB]
Fetched 20.5 kB in 0s (298 kB/s)
Selecting previously unselected package finger.
(Reading database ... 28843 files and directories currently installed.)
Unpacking finger (from .../finger_0.17-15_amd64.deb) ...
Processing triggers for man-db ...
Setting up finger (0.17-15) ...
/dev/pts/1
13:15:42
#apt-get install finger
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  finger
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 20.5 kB of archives.
After this operation, 31.7 kB of additional disk space will be used.
Get:1 http://ftp.ua.debian.org/debian/ wheezy/main finger amd64 0.17-15 [20.5 kB]
Fetched 20.5 kB in 0s (298 kB/s)
Selecting previously unselected package finger.
(Reading database ... 28843 files and directories currently installed.)
Unpacking finger (from .../finger_0.17-15_amd64.deb) ...
Processing triggers for man-db ...
Setting up finger (0.17-15) ...
/dev/pts/0
13:16:50
#finger ivan
Login: ivan                             Name: Ivan Ivanov
Directory: /home/ivan                   Shell: /bin/bash
Office: 9c, 044-123-4567                Home Phone: 044-765-4321
Last login Wed Oct 17 09:53 (EEST) on pts/1 from 192.168.15.120
No mail.
No Plan.
/dev/pts/1
13:16:50
#finger ivan
Login: ivan                             Name: Ivan Ivanov
Directory: /home/ivan                   Shell: /bin/bash
Office: 9c, 044-123-4567                Home Phone: 044-765-4321
Last login Wed Oct 17 09:53 (EEST) on pts/1 from 192.168.15.120
No mail.
No Plan.
/dev/pts/0
13:16:56
#lastlog
Username         Port     From             Latest
root             pts/0    192.168.15.120   Thu Oct 18 08:55:57 +0300 2018
daemon                                     **Never logged in**
bin                                        **Never logged in**
sys                                        **Never logged in**
sync                                       **Never logged in**
games                                      **Never logged in**
man                                        **Never logged in**
lp                                         **Never logged in**
mail                                       **Never logged in**
...
list                                       **Never logged in**
irc                                        **Never logged in**
gnats                                      **Never logged in**
nobody                                     **Never logged in**
libuuid                                    **Never logged in**
Debian-exim                                **Never logged in**
user             pts/2    192.168.15.120   Thu Oct 18 08:56:11 +0300 2018
sshd                                       **Never logged in**
ivan             pts/1    192.168.15.120   Wed Oct 17 09:53:36 +0300 2018
petr             pts/2    192.168.15.120   Wed Oct 17 08:58:57 +0300 2018
/dev/pts/1
13:16:56
#lastlog
Username         Port     From             Latest
root             pts/0    192.168.15.120   Thu Oct 18 08:55:57 +0300 2018
daemon                                     **Never logged in**
bin                                        **Never logged in**
sys                                        **Never logged in**
sync                                       **Never logged in**
games                                      **Never logged in**
man                                        **Never logged in**
lp                                         **Never logged in**
mail                                       **Never logged in**
...
list                                       **Never logged in**
irc                                        **Never logged in**
gnats                                      **Never logged in**
nobody                                     **Never logged in**
libuuid                                    **Never logged in**
Debian-exim                                **Never logged in**
user             pts/2    192.168.15.120   Thu Oct 18 08:56:11 +0300 2018
sshd                                       **Never logged in**
ivan             pts/1    192.168.15.120   Wed Oct 17 09:53:36 +0300 2018
petr             pts/2    192.168.15.120   Wed Oct 17 08:58:57 +0300 2018
/dev/pts/0
13:18:01
#last
user     pts/2        192.168.15.120   Thu Oct 18 08:56   still logged in
root     pts/0        192.168.15.120   Thu Oct 18 08:55   still logged in
root     pts/0        192.168.15.120   Wed Oct 17 10:04 - 17:08  (07:03)
user     pts/3        192.168.15.120   Wed Oct 17 10:01 - 17:08  (07:07)
ivan     pts/1        192.168.15.120   Wed Oct 17 09:53 - 16:56  (07:02)
ivan     pts/1        192.168.15.120   Wed Oct 17 09:46 - 09:53  (00:06)
root     pts/0        192.168.15.120   Wed Oct 17 09:43 - 10:04  (00:20)
user     pts/3        192.168.15.120   Wed Oct 17 08:59 - 10:01  (01:01)
petr     pts/2        192.168.15.120   Wed Oct 17 08:58 - 16:56  (07:57)
ivan     pts/1        192.168.15.120   Wed Oct 17 08:58 - 09:46  (00:47)
root     pts/0        192.168.15.120   Wed Oct 17 08:57 - 09:43  (00:45)
user     pts/4        192.168.15.120   Tue Oct 16 10:49 - 16:54  (06:05)
petr     pts/3        192.168.15.120   Tue Oct 16 10:44 - 16:54  (06:10)
ivan     pts/2        192.168.15.120   Tue Oct 16 10:39 - 16:54  (06:15)
ivan     pts/2        192.168.15.120   Tue Oct 16 10:23 - 10:30  (00:06)
root     pts/0        192.168.15.120   Tue Oct 16 09:50 - 16:54  (07:04)
wtmp begins Tue Oct 16 09:50:26 2018
/dev/pts/1
13:18:01
#last
user     pts/2        192.168.15.120   Thu Oct 18 08:56   still logged in
root     pts/0        192.168.15.120   Thu Oct 18 08:55   still logged in
root     pts/0        192.168.15.120   Wed Oct 17 10:04 - 17:08  (07:03)
user     pts/3        192.168.15.120   Wed Oct 17 10:01 - 17:08  (07:07)
ivan     pts/1        192.168.15.120   Wed Oct 17 09:53 - 16:56  (07:02)
ivan     pts/1        192.168.15.120   Wed Oct 17 09:46 - 09:53  (00:06)
root     pts/0        192.168.15.120   Wed Oct 17 09:43 - 10:04  (00:20)
user     pts/3        192.168.15.120   Wed Oct 17 08:59 - 10:01  (01:01)
petr     pts/2        192.168.15.120   Wed Oct 17 08:58 - 16:56  (07:57)
ivan     pts/1        192.168.15.120   Wed Oct 17 08:58 - 09:46  (00:47)
root     pts/0        192.168.15.120   Wed Oct 17 08:57 - 09:43  (00:45)
user     pts/4        192.168.15.120   Tue Oct 16 10:49 - 16:54  (06:05)
petr     pts/3        192.168.15.120   Tue Oct 16 10:44 - 16:54  (06:10)
ivan     pts/2        192.168.15.120   Tue Oct 16 10:39 - 16:54  (06:15)
ivan     pts/2        192.168.15.120   Tue Oct 16 10:23 - 10:30  (00:06)
root     pts/0        192.168.15.120   Tue Oct 16 09:50 - 16:54  (07:04)
wtmp begins Tue Oct 16 09:50:26 2018
/dev/pts/0
13:18:52
#lastb
btmp begins Mon Oct 15 06:25:11 2018
/dev/pts/1
13:18:52
#lastb
btmp begins Mon Oct 15 06:25:11 2018
/dev/pts/0
13:19:41
#lastb
btmp begins Mon Oct 15 06:25:11 2018
/dev/pts/1
13:19:41
#lastb
btmp begins Mon Oct 15 06:25:11 2018
/dev/pts/0
13:21:20
#chmod o-x `witch finger`
l3script: witch: command not found
chmod: missing operand after `o-x'
Try `chmod --help' for more information.
/dev/pts/1
13:21:20
#chmod o-x `witch finger`
l3script: witch: command not found
chmod: missing operand after `o-x'
Try `chmod --help' for more information.
/dev/pts/0
13:22:59
#chmod o-x `witch finger`
l3script: witch: command not found
chmod: missing operand after `o-x'
Try `chmod --help' for more information.
/dev/pts/1
13:22:59
#chmod o-x `witch finger`
l3script: witch: command not found
chmod: missing operand after `o-x'
Try `chmod --help' for more information.
/dev/pts/0
13:23:24
#chmod `witch finger`
l3script: witch: command not found
chmod: missing operand
Try `chmod --help' for more information.
/dev/pts/1
13:23:24
#chmod `witch finger`
l3script: witch: command not found
chmod: missing operand
Try `chmod --help' for more information.
/dev/pts/0
13:23:34
#chmod o-x `wich finger`
l3script: wich: command not found
chmod: missing operand after `o-x'
Try `chmod --help' for more information.
/dev/pts/1
13:23:34
#chmod o-x `wich finger`
l3script: wich: command not found
chmod: missing operand after `o-x'
Try `chmod --help' for more information.
/dev/pts/0
13:23:44
#chmod o-x `which finger`

/dev/pts/1
13:23:44
#chmod o-x `which finger`

/dev/pts/0
13:23:49
#cat /etc/shadow
root:$6$ppY7xZxX$CnutMU4XxetHko6DW5K/ckfiA6CFeC0cbV/d6rrWE6F5iszqxAaQTwekH3.vBTQPNCakvqusvPcBecndLcbX8.:16248:0:99999:7:::
daemon:*:16248:0:99999:7:::
bin:*:16248:0:99999:7:::
sys:*:16248:0:99999:7:::
sync:*:16248:0:99999:7:::
games:*:16248:0:99999:7:::
man:*:16248:0:99999:7:::
lp:*:16248:0:99999:7:::
mail:*:16248:0:99999:7:::
news:*:16248:0:99999:7:::
...
list:*:16248:0:99999:7:::
irc:*:16248:0:99999:7:::
gnats:*:16248:0:99999:7:::
nobody:*:16248:0:99999:7:::
libuuid:!:16248:0:99999:7:::
Debian-exim:!:16248:0:99999:7:::
user:$6$CkJHVC8E$ykTJUix/7qmcPBJgqnJtCHlWhYfEaImqXcQyeRrwYm6Xi4KaZSfb4FB20ocZ/VlrQzTR2wiEobMxT/OM/FXgd0:16248:0:99999:7:::
sshd:*:16248:0:99999:7:::
ivan:$6$ny1MmK.u$uOsQaX/vxClPGh6adPV0sBrdK/bE03MG36kXWcnClR/dDIfQ/jIsD87RIIvu25BUSUUwSoLX14uzbJIC9AR.m1:17820:0:99999:7:::
petr:$6$ZPH7gA.0$OrSJQ40QAUEGd7ZZlySTtaWjJTSvz8jCgicfm/tJVCMbOQUUatUv47YxG85FGpA/EqWuft4hNCd.nVV63Oigq1:17820:0:99999:7:::
/dev/pts/1
13:23:49
#cat /etc/shadow
root:$6$ppY7xZxX$CnutMU4XxetHko6DW5K/ckfiA6CFeC0cbV/d6rrWE6F5iszqxAaQTwekH3.vBTQPNCakvqusvPcBecndLcbX8.:16248:0:99999:7:::
daemon:*:16248:0:99999:7:::
bin:*:16248:0:99999:7:::
sys:*:16248:0:99999:7:::
sync:*:16248:0:99999:7:::
games:*:16248:0:99999:7:::
man:*:16248:0:99999:7:::
lp:*:16248:0:99999:7:::
mail:*:16248:0:99999:7:::
news:*:16248:0:99999:7:::
...
list:*:16248:0:99999:7:::
irc:*:16248:0:99999:7:::
gnats:*:16248:0:99999:7:::
nobody:*:16248:0:99999:7:::
libuuid:!:16248:0:99999:7:::
Debian-exim:!:16248:0:99999:7:::
user:$6$CkJHVC8E$ykTJUix/7qmcPBJgqnJtCHlWhYfEaImqXcQyeRrwYm6Xi4KaZSfb4FB20ocZ/VlrQzTR2wiEobMxT/OM/FXgd0:16248:0:99999:7:::
sshd:*:16248:0:99999:7:::
ivan:$6$ny1MmK.u$uOsQaX/vxClPGh6adPV0sBrdK/bE03MG36kXWcnClR/dDIfQ/jIsD87RIIvu25BUSUUwSoLX14uzbJIC9AR.m1:17820:0:99999:7:::
petr:$6$ZPH7gA.0$OrSJQ40QAUEGd7ZZlySTtaWjJTSvz8jCgicfm/tJVCMbOQUUatUv47YxG85FGpA/EqWuft4hNCd.nVV63Oigq1:17820:0:99999:7:::
/dev/pts/0
13:27:47
#chage -l ivan
Last password change                                    : Oct 16, 2018
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7
/dev/pts/1
13:27:47
#chage -l ivan
Last password change                                    : Oct 16, 2018
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7
/dev/pts/0
13:36:15
#chage -m 10 ivan

/dev/pts/1
13:36:15
#chage -m 10 ivan

/dev/pts/0
13:39:43
#chage -l ivan
Last password change                                    : Oct 16, 2018
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 10
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7
/dev/pts/1
13:39:43
#chage -l ivan
Last password change                                    : Oct 16, 2018
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 10
Maximum number of days between password change          : 99999
Number of days of warning before password expires       : 7
/dev/pts/0
13:39:47
#chage -M 90 ivan

/dev/pts/1
13:39:47
#chage -M 90 ivan

/dev/pts/0
13:40:58
#chage -l ivan
Last password change                                    : Oct 16, 2018
Password expires                                        : Jan 14, 2019
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 10
Maximum number of days between password change          : 90
Number of days of warning before password expires       : 7
/dev/pts/1
13:40:58
#chage -l ivan
Last password change                                    : Oct 16, 2018
Password expires                                        : Jan 14, 2019
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 10
Maximum number of days between password change          : 90
Number of days of warning before password expires       : 7
/dev/pts/0
13:40:59
#chage -I 4 ivan

/dev/pts/1
13:40:59
#chage -I 4 ivan

/dev/pts/0
13:42:42
#chage -l ivan
Last password change                                    : Oct 16, 2018
Password expires                                        : Jan 14, 2019
Password inactive                                       : Jan 18, 2019
Account expires                                         : never
Minimum number of days between password change          : 10
Maximum number of days between password change          : 90
Number of days of warning before password expires       : 7
/dev/pts/1
13:42:42
#chage -l ivan
Last password change                                    : Oct 16, 2018
Password expires                                        : Jan 14, 2019
Password inactive                                       : Jan 18, 2019
Account expires                                         : never
Minimum number of days between password change          : 10
Maximum number of days between password change          : 90
Number of days of warning before password expires       : 7
/dev/pts/0
13:42:58
#chage
Usage: chage [options] LOGIN
Options:
  -d, --lastday LAST_DAY        set date of last password change to LAST_DAY
  -E, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -h, --help                    display this help message and exit
  -I, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -l, --list                    show account aging information
  -m, --mindays MIN_DAYS        set minimum number of days before password
                                change to MIN_DAYS
  -M, --maxdays MAX_DAYS        set maximim number of days before password
                                change to MAX_DAYS
  -R, --root CHROOT_DIR         directory to chroot into
  -W, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS
/dev/pts/1
13:42:58
#chage
Usage: chage [options] LOGIN
Options:
  -d, --lastday LAST_DAY        set date of last password change to LAST_DAY
  -E, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -h, --help                    display this help message and exit
  -I, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -l, --list                    show account aging information
  -m, --mindays MIN_DAYS        set minimum number of days before password
                                change to MIN_DAYS
  -M, --maxdays MAX_DAYS        set maximim number of days before password
                                change to MAX_DAYS
  -R, --root CHROOT_DIR         directory to chroot into
  -W, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS
/dev/pts/0
13:44:03
#less /etc/login.defs
/dev/pts/1
13:44:03
#less /etc/login.defs
/dev/pts/0
13:49:14
#less /etc/default/useradd
/dev/pts/1
13:49:14
#less /etc/default/useradd
/dev/pts/0
13:49:48
#nano /etc/default/useradd
/dev/pts/1
13:49:48
#nano /etc/default/useradd
/dev/pts/0
13:50:59