| /l3/users/16-07-2018/NT-Ladm/debian2.net.nt/root :1 :2 :3 :4 :5 |
|
|
#useradd ivan
|
|
#echo $?
0 |
|
#useradd ivan
useradd: пользователь «ivan» уже существует |
|
#echo $?
9 |
|
#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
|
|
#LANG=''
|
|
#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
|
|
#man useradd
|
|
#passwd ivan
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully |
|
#userdel ivan
|
|
#echo $?
0 |
|
#useradd -m -s /bin/bash ivan
|
|
#passwd ivan
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully |
|
#useradd -m -s /bin/bash petr
|
|
#passwd petr
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully |
|
#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) |
|
#cd /
|
|
#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 |
|
#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 |
|
#cd ivan
l3script: cd: ivan: No such file or directory |
|
#cd root/
|
|
#cd //
|
|
#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 |
|
#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 |
|
#cd /
|
|
#cd home/
|
|
#ls
ivan petr user |
|
#cd ivan/
|
|
#cd /
|
|
#cd
|
|
#cd /
|
|
#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 |
|
#cd
|
|
#ls -l
total 8 -rw-r--r-- 1 root root 5268 Oct 13 2014 install |
|
#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 |
|
#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 |
|
#alias ls='ls --color'
|
|
#ls
install |
|
#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 |
|
#alias
alias ls='ls --color' |
|
#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 |
|
#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) |
|
#echo privet > /dev/pt
ptmx pts/ |
|
#echo privet > /dev/pts/2
|
|
#mailq
|
|
#which who
/usr/bin/who |
|
#which mailq
/usr/bin/mailq |
|
#ls -l /usr/bin/who
-rwxr-xr-x 1 root root 55888 Jan 26 2013 /usr/bin/who |
|
#ls -l /usr/bin/mail
mail mail-lock mail-touchlock mail-unlock mailq mailx |
|
#ls -l /usr/bin/mailq
lrwxrwxrwx 1 root root 13 Jan 2 2013 /usr/bin/mailq -> ../sbin/exim4 |
|
#ls -l /usr/sbin/exim4
-rwsr-xr-x 1 root root 973824 Jan 2 2013 /usr/sbin/exim4 |
|
#ls -l /dev/cdrom1
lrwxrwxrwx 1 root root 3 Jul 16 08:39 /dev/cdrom1 -> sr0 |
|
#ls -l /dev/sr0
brw-rw---T 1 root cdrom 11, 0 Jul 16 08:39 /dev/sr0 |
|
#mkfifo /tmp/test
|
|
#echo $?
0 |
|
#ls -l /tmp/test
prw-r--r-- 1 root root 0 Jul 16 12:02 /tmp/test |
|
#echo prive > /tmp/test
|
|
#ls -l /dev/log
srw-rw-rw- 1 root root 0 Jul 16 08:39 /dev/log |
|
#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 |
|
#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 |
|
#cd /home/ivan/
|
|
#cd /home/petr/
|
|
#cd -
/home/ivan |
|
#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) ... |
|
#cd
|
|
#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
|
|
#more install
|
|
#less install
|
|
#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
|
|
#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
|
|
#ln install install2
|
|
#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 |
|
#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
|
|
#man cp
|
|
#cp install test
|
|
#ls
install install2 test |
|
#which vi
/usr/bin/vi |
|
#which vim
/usr/bin/vim |
|
#ls -l /usr/bin/vi
lrwxrwxrwx 1 root root 20 Jun 27 2014 /usr/bin/vi -> /etc/alternatives/vi |
|
#ls -l /etc/alternatives/vi
lrwxrwxrwx 1 root root 18 Jun 27 2014 /etc/alternatives/vi -> /usr/bin/vim.basic |
|
#ls -l /usr/bin/vim
vim vim.basic vim.tiny vimdiff vimtutor |
|
#ls -l /usr/bin/vim.basic
-rwxr-xr-x 1 root root 1876072 Feb 10 2013 /usr/bin/vim.basic |
|
|