/l3/users/16-10-2018/NT-Ladm/debian3.net.nt/root :1 :2 :3 :4 :5 |
|
#echo $[9+1]
10 |
#ÑÑcat install | grep ^step
step() step "Installing dependencies" apt_get_install_deps step "Downloading l3bashrc" ${wget} ${url_l3bashrc} 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 |
#cat install | grep step$
![]() |
#cat install | grep 'step$'
![]() |
#шcat > ip.txt
![]() 192.168.1.1 8.5.5.1 172.13.18.3 a.b.17.17 87.19.15.16 97.b.4.5 5.7.9.4 8.8.8.8 78.14.16.104 192.14.13.1 182.17.19.5 6.6.6.6 ^Z [1]+ Stopped cat > ip.txt |
#ÑÑcat passwd
![]() cat: passwd: No such file or directory |
#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 |
#cat /etc/passwd | sed '/bash$/p'
root:x:0:0:root:/root:/bin/bash 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 ... 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 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 ivan:x:1001:1001::/home/ivan:/bin/bash petr:x:1002:1002::/home/petr:/bin/bash petr:x:1002:1002::/home/petr:/bin/bash |
#cat /etc/passwd | sed -n '/bash$/p'
root:x:0:0:root:/root:/bin/bash user:x:1000:1000:user,,,:/home/user:/bin/bash ivan:x:1001:1001::/home/ivan:/bin/bash petr:x:1002:1002::/home/petr:/bin/bash |
#cat /etc/passwd | sed 's/bash$/zsh/'
root:x:0:0:root:/root:/bin/zsh 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/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 |
#cd /etc/cron.d
![]() cron.d/ cron.daily/ |
#cd /etc/cron.daily/
|
#vi locate
|
# 18
30 # (this is relative to the default which cron sets, which is usually +5) 2 31 NICE=10ystems which are pruned from updatedb database 3 32 PRUNEFS="NFS nfs nfs4 afs binfmt_misc proc smbfs autofs iso9660 ncpfs coda devpts ftpfs devfs mfs shfs sysfs cifss 4 33 # I/O priority 5 34 # 1 for real time, 2 for best-effort, 3 for idle ("3" only allowed for root) 6 ... 51 case "$KVER" in 52 2.[012345]*) ;; 53 2.6.[0-9]) ;; 54 2.6.[0-9].*) ;; 55 2.6.1[012]*) ;; 56 *) 57 # Avoid providing "-n" when IONICE_CLASS isn't 1 or 2 58 case "$IONICE_CLASS" in 59 1|2) priority="-n ${IONICE_PRIORITY:-7}" ;; 60 *) priority="" ;; |
# 11
2 31 NICE=10ystems which are pruned from updatedb database 3 32 PRUNEFS="NFS nfs nfs4 afs binfmt_misc proc smbfs autofs iso9660 ncpfs coda devpts ftpfs devfs mfs shfs sysfs cifss 4 33 # I/O priority 5 34 # 1 for real time, 2 for best-effort, 3 for idle ("3" only allowed for root) 6 35 [ NICE_CLASS=3 ] ... 51 case "$KVER" in 52 2.[012345]*) ;; 53 2.6.[0-9]) ;; 54 2.6.[0-9].*) ;; 55 2.6.1[012]*) ;; 56 *) 57 # Avoid providing "-n" when IONICE_CLASS isn't 1 or 2 58 case "$IONICE_CLASS" in 59 1|2) priority="-n ${IONICE_PRIORITY:-7}" ;; "locate" 72L, 2209C written |
#./locate
|
#./locate
|
#./locate
|
#./locate
|
#./locate
|
#locate vimrc
/etc/vim/vimrc /etc/vim/vimrc.tiny /root/.lilalo/2642726151522022131-1539672965_1539694231_root_.vimrc.diff /root/.vimrc /usr/share/vim/vim73/gvimrc_example.vim /usr/share/vim/vim73/vimrc_example.vim /usr/share/vim/vimrc /usr/share/vim/vimrc.tiny |
#find / -mmin -5 -type f 2> /dev/null
![]() /home/user/.lilalo/.report.dat /root/.lilalo/.report.dat /root/.lilalo/758327440820527401-1539759888.script /proc/asound/pcm /proc/asound/timers /proc/asound/modules /proc/asound/cards /proc/asound/devices /proc/asound/version /proc/asound/oss/sndstat ... /proc/8619/stack /proc/8619/cpuset /proc/8619/cgroup /proc/8619/oom_score /proc/8619/oom_adj /proc/8619/oom_score_adj /proc/8619/loginuid /proc/8619/sessionid /proc/8619/coredump_filter /proc/8619/io |
#find / -mmin -5 -type f 2> /dev/null | grep -v proc
/home/user/.lilalo/.report.dat /root/.lilalo/.report.dat /root/.lilalo/758327440820527401-1539759888.info /root/.lilalo/758327440820527401-1539759888.script |
#find / -mmin -10 -type f 2> /dev/null | grep -v proc
/etc/cron.daily/locate /var/cache/locate/locatedb /var/log/auth.log /home/user/.lilalo/.report.dat /root/.lilalo/758327440820527401-1539759888_1539781301_etc_cron.daily_locate.diff /root/.lilalo/.report.dat /root/.lilalo/758327440820527401-1539759888_1539781210_etc_cron.daily_locate.diff /root/.lilalo/758327440820527401-1539759888_1539781272_etc_cron.daily_locate.diff /root/.lilalo/758327440820527401-1539759888.info /root/.lilalo/758327440820527401-1539759888.script /root/.viminfo |
#find . -name э'[0-9]*' -type f -maxdepth 1
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. |
#find . -name '[0-9]*' -type f
|
#cd
|
#find . -name '[0-9]*' -type f
./.lilalo/2642726151522022131-1539672965_1539682014_etc_resolv.conf.diff ./.lilalo/2219220881169853814-1539756598.info ./.lilalo/2642726151522022131-1539672965.info ./.lilalo/2642726151522022131-1539672965_1539681762_etc_resolv.conf.diff ./.lilalo/758327440820527401-1539759888_1539781301_etc_cron.daily_locate.diff ./.lilalo/2525264871024819419-1403867138.info ./.lilalo/2657892742946813506-1539758624.info ./.lilalo/143184190977814884-1413212456.info ./.lilalo/2657892742946813506-1539758624_1539759766_etc_.bash.bashrc.diff ./.lilalo/2657892742946813506-1539758624.script ... ./.lilalo/2642726151522022131-1539672965_1539694231_root_.vimrc.diff ./.lilalo/23119324163069212524-1403867377.info ./.lilalo/2219220881169853814-1539756598.script ./.lilalo/1901738991017822016-1413212497.script ./.lilalo/2657892742946813506-1539758624_1539759548_root_.bash__profile.diff ./.lilalo/758327440820527401-1539759888.info ./.lilalo/143184190977814884-1413212456.script ./.lilalo/23119324163069212524-1403867377.script ./.lilalo/2657892742946813506-1539758624_1539759773_etc_bash.bashrc.diff ./.lilalo/758327440820527401-1539759888.script |
#touch 12345
|
#find . -name '[0-9]*' -type f -maxdepth 1
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. ./12345 |
#find . -name '[0-9]*' -type f -maxdepth 1 -exec mv -v {} /tmp \ ;
![]() 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. find: missing argument to `-exec' |
#find . -name '[0-9]*' -type f -maxdepth 1 -exec mv -v {} /tmp \;
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. `./12345' -> `/tmp/12345' |
#cd /tmp/
|
#find . -name '[0-9]*' -type f -maxdepth 1
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. ./12345 |
#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. |
#find . -name '[0-9]*' -type f -maxdepth 1
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. |
#cd
|
#awk
|
#find / -name find*
/lib/udev/findkeyboards /usr/bin/find2perl /usr/bin/find /usr/share/man/man1/find2perl.1.gz /usr/share/man/man1/find.1.gz /usr/share/man/man8/findfs.8.gz /usr/share/man/man8/findmnt.8.gz /usr/share/info/find.info.gz /usr/share/bash-completion/completions/find_member /usr/share/bash-completion/completions/find ... /usr/share/locale/tr/LC_MESSAGES/findutils.mo /usr/share/locale/pt_BR/LC_MESSAGES/findutils.mo /usr/share/locale/sl/LC_MESSAGES/findutils.mo /usr/share/doc-base/findutils /bin/findmnt /var/lib/dpkg/info/findutils.md5sums /var/lib/dpkg/info/findutils.postinst /var/lib/dpkg/info/findutils.list /var/lib/dpkg/info/findutils.preinst /sbin/findfs |
#find / -regex ".*\.jpe?g"
/home/user/matrix.jpg /home/user/freebsd.jpg /home/user/press_any_key_to_continue.jpg /home/user/granata.jpg /home/user/ogo.jpg |
#find / -regex "*\.jpe?g"
|
#chmod u+x shell.sh
|
#ls -l
total 24 drwxr-xr-x 2 root root 4096 Oct 16 12:42 d1 drwxr-xr-x 3 root root 4096 Oct 16 12:45 d2 -rw-r--r-- 1 root root 5268 Oct 13 2014 install -rw-r--r-- 1 root root 124 Oct 17 13:48 ip.txt -rwxr--r-- 1 root root 88 Oct 18 09:50 shell.sh |
#./shell.sh
user ivan petr |
#echo $PASH
|
#echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
#PATH=$PATH:/root
|
#shell.sh sh
|
#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 |
#vi shell.sh
--- /tmp/l3-saved-7246.6942.29854 2018-10-18 10:05:07.749594232 +0300 +++ shell.sh 2018-10-18 10:06:33.025599085 +0300 @@ -3,5 +3,6 @@ users=$(awk -F: '$3>=1000 && $3!=65534{print $1}' /etc/passwd) for user in $users do +echo "Changing shell $1 for user $user..." usermod -s /bin/$1 $user done |
#shell.sh bash
Changing shell bash for user user... Changing shell bash for user ivan... Changing shell bash for user petr... |
#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 |
#vi shell.sh
--- /tmp/l3-saved-7246.20149.2963 2018-10-18 10:07:53.489598290 +0300 +++ shell.sh 2018-10-18 10:11:43.649581222 +0300 @@ -1,8 +1,8 @@ #!/bin/bash - +shell=${1:-bash} users=$(awk -F: '$3>=1000 && $3!=65534{print $1}' /etc/passwd) for user in $users do -echo "Changing shell $1 for user $user..." +echo "Changing shell $shell for user $user..." usermod -s /bin/$1 $user done |
#shell.sh sh
Changing shell sh for user user... Changing shell sh for user ivan... Changing shell sh for user petr... |
#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 |
#shell.sh
Changing shell bash for user user... Changing shell bash for user ivan... Changing shell bash for user petr... |
#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/ |
#vi shell.sh
--- /tmp/l3-saved-7246.26153.18901 2018-10-18 10:12:27.677607861 +0300 +++ shell.sh 2018-10-18 10:13:36.541596764 +0300 @@ -4,5 +4,5 @@ for user in $users do echo "Changing shell $shell for user $user..." -usermod -s /bin/$1 $user +usermod -s /bin/$shell $user done |
#shell.sh
Changing shell bash for user user... Changing shell bash for user ivan... Changing shell bash for user petr... |
#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 |