/l3/users/26-03-2018/NT-Ladm/debian2.net.nt/root :1 :2 :3 |
|
#bash
![]() root@debian2:~# $a bash: 1: команда не найдена root@debian2:~# echo a a root@debian2:~# echo a$ a$ root@debian2:~# echo $a 1 root@debian2:~# exit exit |
#bash
root@debian2:~# $a bash: 1: команда не найдена root@debian2:~# echo a a root@debian2:~# echo a$ a$ root@debian2:~# echo $a 1 root@debian2:~# exit exit |
#env
![]() SHELL=/bin/bash TERM=xterm HISTSIZE=2000 SSH_CLIENT=192.168.16.126 49170 22 L3_PARENT_TTY=/dev/pts/3 L3_TAMPERED_EDITORS= vi vim pico nano vi vim pico nano SSH_TTY=/dev/pts/2 USER=root HISTFILESIZE=2000 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin MAIL=/var/mail/root L3_SESSION_ID=3006280001143314300-1522217844 a=1 PWD=/root LANG=ru_RU.UTF-8 |
#env
SHELL=/bin/bash TERM=xterm HISTSIZE=2000 SSH_CLIENT=192.168.16.126 49170 22 L3_PARENT_TTY=/dev/pts/3 L3_TAMPERED_EDITORS= vi vim pico nano vi vim pico nano SSH_TTY=/dev/pts/2 USER=root HISTFILESIZE=2000 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin MAIL=/var/mail/root L3_SESSION_ID=3006280001143314300-1522217844 a=1 PWD=/root LANG=ru_RU.UTF-8 |
#vi shell.sh
![]() --- /dev/null 2018-03-26 08:41:41.503999993 +0300 +++ shell.sh 2018-03-28 10:19:42.272414836 +0300 @@ -0,0 +1,2 @@ +#!/bin/bash + |
#vi shell.sh
![]() --- /tmp/l3-saved-8382.16299.13565 2018-03-28 10:19:45.420412765 +0300 +++ shell.sh 2018-03-28 10:27:46.712406812 +0300 @@ -1,2 +1,9 @@ #!/bin/bash +users=$(awk -F: '$3=1000 && $3!=65534 {print $1}' /etc/passwd) + +for user in $users + do + echo "changing shell for user $user..." + usermod -s /bin/zsh $user + done |
#./shell.sh
![]() changing shell for user root... changing shell for user daemon... changing shell for user bin... changing shell for user sys... changing shell for user sync... changing shell for user games... changing shell for user man... changing shell for user lp... changing shell for user mail... changing shell for user news... ... changing shell for user backup... changing shell for user list... changing shell for user irc... changing shell for user gnats... changing shell for user libuuid... changing shell for user Debian-exim... changing shell for user user... changing shell for user sshd... changing shell for user ivan... changing shell for user petr... |
#./shell.sh
changing shell for user root... changing shell for user daemon... changing shell for user bin... changing shell for user sys... changing shell for user sync... changing shell for user games... changing shell for user man... changing shell for user lp... changing shell for user mail... changing shell for user news... ... changing shell for user backup... changing shell for user list... changing shell for user irc... changing shell for user gnats... changing shell for user libuuid... changing shell for user Debian-exim... changing shell for user user... changing shell for user sshd... changing shell for user ivan... changing shell for user petr... |
#Press ENTER or type command to continue
![]() root:x:0:0:root:/root:/bin/zsh daemon:x:1:1:daemon:/usr/sbin:/bin/zsh bin:x:2:2:bin:/bin:/bin/zsh sys:x:3:3:sys:/dev:/bin/zsh sync:x:4:65534:sync:/bin:/bin/zsh games:x:5:60:games:/usr/games:/bin/zsh man:x:6:12:man:/var/cache/man:/bin/zsh lp:x:7:7:lp:/var/spool/lpd:/bin/zsh mail:x:8:8:mail:/var/mail:/bin/zsh news:x:9:9:news:/var/spool/news:/bin/zsh ... list:x:38:38:Mailing List Manager:/var/list:/bin/zsh irc:x:39:39:ircd:/var/run/ircd:/bin/zsh gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/zsh nobody:x:65534:65534:nobody:/nonexistent:/bin/sh libuuid:x:100:101::/var/lib/libuuid:/bin/zsh Debian-exim:x:101:103::/var/spool/exim4:/bin/zsh user:x:1000:1000:user,,,:/home/user:/bin/zsh sshd:x:102:65534::/var/run/sshd:/bin/zsh ivan:x:1001:1001::/home/ivan:/bin/zsh petr:x:1002:1002::/home/petr:/bin/zsh |
#Press ENTER or type command to continue
root:x:0:0:root:/root:/bin/zsh daemon:x:1:1:daemon:/usr/sbin:/bin/zsh bin:x:2:2:bin:/bin:/bin/zsh sys:x:3:3:sys:/dev:/bin/zsh sync:x:4:65534:sync:/bin:/bin/zsh games:x:5:60:games:/usr/games:/bin/zsh man:x:6:12:man:/var/cache/man:/bin/zsh lp:x:7:7:lp:/var/spool/lpd:/bin/zsh mail:x:8:8:mail:/var/mail:/bin/zsh news:x:9:9:news:/var/spool/news:/bin/zsh ... list:x:38:38:Mailing List Manager:/var/list:/bin/zsh irc:x:39:39:ircd:/var/run/ircd:/bin/zsh gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/zsh nobody:x:65534:65534:nobody:/nonexistent:/bin/sh libuuid:x:100:101::/var/lib/libuuid:/bin/zsh Debian-exim:x:101:103::/var/spool/exim4:/bin/zsh user:x:1000:1000:user,,,:/home/user:/bin/zsh sshd:x:102:65534::/var/run/sshd:/bin/zsh ivan:x:1001:1001::/home/ivan:/bin/zsh petr:x:1002:1002::/home/petr:/bin/zsh |
#vi shell.sh
![]() --- /tmp/l3-saved-8382.381.29208 2018-03-28 10:35:23.484415800 +0300 +++ shell.sh 2018-03-28 10:35:31.884418078 +0300 @@ -1,6 +1,6 @@ #!/bin/bash -users=$(awk -F: '$3=1000 && $3!=65534 {print $1}' /etc/passwd) +users=$(awk -F: '$3=>1000 && $3!=65534 {print $1}' /etc/passwd) for user in $users do |
#scp 192.168.13.6:/etc/passwd /etc
![]() The authenticity of host '192.168.13.6 (192.168.13.6)' 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)? yes Warning: Permanently added '192.168.13.6' (ECDSA) to the list of known hosts. root@192.168.13.6's password: passwd 100% 1028 1.0KB/s 00:00 |
#scp 192.168.13.6:/etc/passwd /etc
The authenticity of host '192.168.13.6 (192.168.13.6)' 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)? yes Warning: Permanently added '192.168.13.6' (ECDSA) to the list of known hosts. root@192.168.13.6's password: passwd 100% 1028 1.0KB/s 00:00 |
#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/zsh sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin ivan:x:1001:1001::/home/ivan:/bin/zsh petr:x:1002:1002::/home/petr:/bin/zsh popa3d:x:103:105::/var/lib/popa3d:/bin/false |
#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/zsh sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin ivan:x:1001:1001::/home/ivan:/bin/zsh petr:x:1002:1002::/home/petr:/bin/zsh popa3d:x:103:105::/var/lib/popa3d:/bin/false |
#vi shell.sh
![]() --- /tmp/l3-saved-8382.28213.26593 2018-03-28 10:37:39.120436991 +0300 +++ shell.sh 2018-03-28 10:59:37.768414039 +0300 @@ -1,9 +1,10 @@ #!/bin/bash -users=$(awk -F: '$3=>1000 && $3!=65534 {print $1}' /etc/passwd) +users=$(awk -F: '$3>=1000 && $3!=65534 {print $1}' /etc/passwd) +shell=$1 for user in $users do - echo "changing shell for user $user..." - usermod -s /bin/zsh $user + echo "changing shell $shell for user $user..." + usermod -s /bin/$shell $user done |
#vi shell.sh
![]() --- /tmp/l3-saved-8382.1612.2533 2018-03-28 11:01:51.820356197 +0300 +++ shell.sh 2018-03-28 11:03:28.060425987 +0300 @@ -1,7 +1,7 @@ #!/bin/bash users=$(awk -F: '$3>=1000 && $3!=65534 {print $1}' /etc/passwd) -shell=$1 +shell=${1:-bash} for user in $users do |
#./shell.sh
![]() changing shell bash for user user... usermod: изменения не внесены changing shell bash for user ivan... usermod: изменения не внесены changing shell bash for user petr... usermod: изменения не внесены |
#./shell.sh
changing shell bash for user user... usermod: изменения не внесены changing shell bash for user ivan... usermod: изменения не внесены changing shell bash for user petr... usermod: изменения не внесены |
#~
![]() 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$HavUO65k$xquY5VrMrAUuHQvZZkqxddFefhIcvGb1JOcWIADGJqx0a8QJCQU1DXotg6ltI0s3U3aycXi5anxUHsEWx4XF40:17616:0:99999:7::: petr:$6$MBEvzXFn$1xn/EQmbg06SPyM.eekTb/jrUSEq8gfEbmTJYiINfC5XHPD6d3dK0sGyDV61rlADt8XmrobDwjOdIlWf/eeOO1:17616:0:99999:7::: |
#~
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$HavUO65k$xquY5VrMrAUuHQvZZkqxddFefhIcvGb1JOcWIADGJqx0a8QJCQU1DXotg6ltI0s3U3aycXi5anxUHsEWx4XF40:17616:0:99999:7::: petr:$6$MBEvzXFn$1xn/EQmbg06SPyM.eekTb/jrUSEq8gfEbmTJYiINfC5XHPD6d3dK0sGyDV61rlADt8XmrobDwjOdIlWf/eeOO1:17616:0:99999:7::: |
#chfn ivan
![]() Изменение информации о пользователе ivan Введите новое значение или нажмите ENTER для выбора значения по умолчанию Полное имя []: Ivan Ivanov Номер комнаты []: 9D Рабочий телефон []: 111 Домашний телефон []: 111 11 11 Другое []: LOL |
#chfn ivan
Изменение информации о пользователе ivan Введите новое значение или нажмите ENTER для выбора значения по умолчанию Полное имя []: Ivan Ivanov Номер комнаты []: 9D Рабочий телефон []: 111 Домашний телефон []: 111 11 11 Другое []: LOL |
#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:Ivan Ivanov,9D,111,111 11 11,LOL:/home/ivan:/bin/bash petr:x:1002:1002::/home/petr:/bin/bash popa3d:x:103:105::/var/lib/popa3d:/bin/false |
#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:Ivan Ivanov,9D,111,111 11 11,LOL:/home/ivan:/bin/bash petr:x:1002:1002::/home/petr:/bin/bash popa3d:x:103:105::/var/lib/popa3d:/bin/false |