/l3/users/27-3-2017/NT-Ladm/debian3.net.nt/root :1 :2 :3 :4 :5 :6 :7 :8 :9 :10 |
|
#~
root@192.168.13.6's password: #!/bin/bash if [ $# -gt 1 ] then exit 2 fi users=`awk -F: '$3>=1000&&$3!=65534{print $1}' /etc/passwd | tr "\n" " "` for user in $users do echo "Changing shell for user $user..." usermod -s /bin/${1:-bash} $user done |
#cat shell.sh
#!/bin/bash if [ $# -gt 1 ] then exit 2 fi users=`awk -F: '$3>=1000&&$3!=65534{print $1}' /etc/passwd | tr "\n" " "` for user in $users do echo "Changing shell for user $user" usermod -s /bin/${1:-bash} $user done |
#vim shell.sh
--- /tmp/l3-saved-14496.11326.14217 2017-03-29 15:00:27.775924513 +0300 +++ shell.sh 2017-03-29 15:00:45.275925814 +0300 @@ -1,5 +1,6 @@ #!/bin/bash -if [ $# -gt 1 ] then +if [ $# -gt 1 ] +then exit 2 fi users=`awk -F: '$3>=1000&&$3!=65534{print $1}' /etc/passwd | tr "\n" " "` |
#./shell.sh
Changing shell for user user usermod: изменения не внесены Changing shell for user ivan usermod: изменения не внесены Changing shell for user petr usermod: изменения не внесены Changing shell for user anna usermod: изменения не внесены |
#./shell.sh sh
Changing shell for user user Changing shell for user ivan Changing shell for user petr Changing shell for user anna |
#./shell.sh bash
Changing shell for user user Changing shell for user ivan Changing shell for user petr Changing shell for user anna |
#echo $OSTYPE
linux-gnu |
#set
BASH=/usr/local/bin/l3script BASHOPTS=checkwinsize:cmdhist:expand_aliases:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath BASH_ALIASES=() BASH_ARGC=() BASH_ARGV=() BASH_CMDS=() BASH_LINENO=() BASH_SOURCE=() BASH_VERSINFO=([0]="4" [1]="2" [2]="37" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu") BASH_VERSION='4.2.37(1)-release' ... MACHTYPE=x86_64-pc-linux-gnu MAIL=/var/mail/root MAILCHECK=60 OLDPWD=/home/user OPTERR=1 OPTIND=1 OSTYPE=linux-gnu PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PIPESTATUS=([0]="0") PPID=14495 |
#vim shell.sh
|
#~
TEST(1) User Commands TEST(1) NAME test - check file types and compare values NAME SYNOPSIS test EXPRESSIONle types and compare values test [ EXPRESSION ] [ ] [ OPTION ... Except for -h and -L, all FILE-related tests dereference symbolic links. Beware that parentheses need to be escaped (e.g., by backslashes) for shells. INTEGER may also be -l STRING, which evalu‐ ates to the length of STRING. NOTE: [ honors the --help and --version options, but test does not. test treats each of those as it treats any other nonempty STRING. NOTE: your shell may have its own version of test and/or [, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it sup‐ ports. AUTHOR Written by Kevin Braunsdorf and Matthew Bradburn. REPORTING BUGS Report test bugs to bug-coreutils@gnu.org GNU coreutils home page: <http://www.gnu.org/software/coreutils/> |
#man test
|
#vim shell.sh
|
#vim shell.sh &
|
#jobs
[1]+ Stopped vim shell.sh |
#fg $1
#!/bin/bash if [ $# -gt 1 ] exit 2 then fi users=` do -F: '$3>=1000&&$3!=65534{print $1}' /etc/passwd | tr "\n" " "` echo "Changing shell for user $user" for user in $us usermod -s /bin/${1:-bash} $user done "shell.sh" 11L, 222C |
#~
![]() l3script: systemclt: команда не найдена |
#sudo systemctl
![]() sudo: systemctl: command not found |
#cd /etc/init.d
|
#ls
acpid checkroot-bootclean.sh cron hwclock.sh kmod mountdevsubfs.sh mtab.sh rc reboot sendsigs sudo umountnfs.sh bootlogs checkroot.sh exim4 kbd motd mountkernfs.sh netdiag rc.local rmnologin single udev umountroot bootmisc.sh console-cyrillic halt keyboard-setup mountall-bootclean.sh mountnfs-bootclean.sh networking rcS rsyslog skeleton udev-mtab urandom checkfs.sh console-setup hostname.sh killprocs mountall.sh mountnfs.sh procps README screen-cleanup ssh umountfs |
#vim cron
|
#$status_of_proc
|
#$status_of_proc /run/
![]() acpid.pid crond.pid exim4/ initramfs/ motd.dynamic network/ screen/ shm/ sshd.pid utmp acpid.socket crond.reboot initctl lock/ mount/ rsyslogd.pid sendsigs.omit.d/ sshd/ udev/ |
#$status_of_proc /run/
![]() acpid.pid crond.pid exim4/ initramfs/ motd.dynamic network/ screen/ shm/ sshd.pid utmp acpid.socket crond.reboot initctl lock/ mount/ rsyslogd.pid sendsigs.omit.d/ sshd/ udev/ |
#$status_of_proc /run/crond.pid
![]() l3script: /run/crond.pid: Отказано в доступе |
#sudo $status_of_proc /run/crond.pid
![]() sudo: /run/crond.pid: command not found |
#cat /run/crond.pid
1942 |
#$status_of_proc 1942
![]() l3script: 1942: команда не найдена |
#$(status_of_proc) 1942
![]() l3script: status_of_proc: команда не найдена l3script: 1942: команда не найдена |
#env
SHELL=/bin/bash TERM=xterm HISTSIZE=2000 SSH_CLIENT=192.168.16.187 49228 22 L3_PARENT_TTY=/dev/pts/0 OLDPWD=/home/user/scripts L3_TAMPERED_EDITORS= vi vim pico nano SSH_TTY=/dev/pts/0 USER=root HISTFILESIZE=2000 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin MAIL=/var/mail/root L3_SESSION_ID=31383263589649259-1490769712 a=1 PWD=/etc/init.d LANG=ru_RU.UTF-8 |
#set | grep status
![]() |
#cd ~/script
![]() l3script: cd: /root/script: Нет такого файла или каталога |
#cd root
![]() l3script: cd: root: Нет такого файла или каталога |
#ls
acpid checkroot-bootclean.sh cron hwclock.sh kmod mountdevsubfs.sh mtab.sh rc reboot sendsigs sudo umountnfs.sh bootlogs checkroot.sh exim4 kbd motd mountkernfs.sh netdiag rc.local rmnologin single udev umountroot bootmisc.sh console-cyrillic halt keyboard-setup mountall-bootclean.sh mountnfs-bootclean.sh networking rcS rsyslog skeleton udev-mtab urandom checkfs.sh console-setup hostname.sh killprocs mountall.sh mountnfs.sh procps README screen-cleanup ssh umountfs |
#cd ~user/scripts/
|
#ls
shell.sh |
#vim proc.sh
![]() --- /dev/null 2017-03-27 13:30:21.879999998 +0300 +++ proc.sh 2017-03-29 15:42:02.687923137 +0300 @@ -0,0 +1,8 @@ +#!/bin/bash + +i=1 +while [ $i -lt 1000000 ] + do + echo $i > /dev/`who | awk '$1~/ivan/{print $2}'` + + done |
#cd /usr/local/bin
|
#ls
l3-agent l3-config l3script |
#man chfn
|
#chfn ivan
![]() Ðзменение инÑоÑмаÑии о полÑзоваÑеле ivan ÐведиÑе новое знаÑение или нажмиÑе ENTER Ð´Ð»Ñ Ð²ÑбоÑа знаÑÐµÐ½Ð¸Ñ Ð¿Ð¾ ÑмолÑÐ°Ð½Ð¸Ñ Ðолное Ð¸Ð¼Ñ []: ÐваÑик ТелеÑик ÐÐ¾Ð¼ÐµÑ ÐºÐ¾Ð¼Ð½Ð°ÑÑ []: 9ÐРРабоÑий ÑелеÑон []: в911 ÐомаÑний ÑелеÑон []: 123-34-54 ÐÑÑгое []: ÑелÑнин chfn: Ð¸Ð¼Ñ Â«ÐваÑик ТелеÑик» ÑодеÑÐ¶Ð¸Ñ Ð½Ðµ ASCII-ÑÐ¸Ð¼Ð²Ð¾Ð»Ñ chfn: Ð½Ð¾Ð¼ÐµÑ ÐºÐ¾Ð¼Ð½Ð°ÑÑ Â«9Ðл ÑодеÑÐ¶Ð¸Ñ Ð½Ðµ ASCII-ÑÐ¸Ð¼Ð²Ð¾Ð»Ñ chfn: некоÑÑекÑное знаÑение номеÑа ÑелеÑона «в911» |
#chfn ivan
![]() Изменение информации о пользователе ivan Введите новое значение или нажмите ENTER для выбора значения по умолчанию Полное имя []: ^C |
#chfn ivan
Изменение информации о пользователе ivan Введите новое значение или нажмите ENTER для выбора значения по умолчанию Полное имя []: Ivasyk Telesyk Номер комнаты []: 9D Рабочий телефон []: 911 Домашний телефон []: 911-11-11 Другое []: village |
|