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

Содержание

Журнал

Среда (09/09/09)

/dev/ttyp8
14:27:22
#[root@fbsd5:tmp]# chmod +x for3
~   for i in `jot - 500 600`
  3 do
  4 pw useradd user$i -s /usr/local/bin/bash -L russian -m -d /home/user$i
  5 echo password | pw usermod user$i -h 0
  6 done
  7
~
~
~
~
...
~
~
~
~
~
~
~
~
~
"for3" 7L, 172C written
14:27:41
#[root@fbsd5:tmp]# ssh 127.0.0.1 -l user600
+ for i in '`jot - 500 600`'
+ pw useradd user574 -s /usr/local/bin/bash -L russian -m -d /home/user574
+ echo password
+ pw usermod user574 -h 0
+ for i in '`jot - 500 600`'
+ pw useradd user575 -s /usr/local/bin/bash -L russian -m -d /home/user575
+ echo password
+ pw usermod user575 -h 0
+ for i in '`jot - 500 600`'
+ pw useradd user576 -s /usr/local/bin/bash -L russian -m -d /home/user576
...
You may also use sysinstall(8) to re-enter the installation and
configuration utility.  Edit /etc/motd to change this login announcement.
You can often get answers to your questions about FreeBSD by searching in the
FreeBSD mailing list archives at
        http://www.FreeBSD.org/search/search.html
[user600@fbsd5 ~]$ pwd
/home/user600
[user600@fbsd5 ~]$ exit
logout
Connection to 127.0.0.1 closed.
14:28:49
#[root@fbsd5:tmp]# scp for3 192.168.16.1:/tmp/scritps/
~
~
~
~
~
~
~
"for3" 7L, 172C written
The authenticity of host '192.168.16.1 (192.168.16.1)' can't be established.
DSA key fingerprint is 85:66:04:0d:64:83:45:f3:35:58:eb:35:cc:e5:92:50.
Are you sure you want to continue connecting (yes/no)? yser^?^?
Please type 'yes' or 'no': yes
Warning: Permanently added '192.168.16.1' (DSA) to the list of known hosts.
root@192.168.16.1's password:
scp: /tmp/scritps/: Is a directory
14:29:53
#[root@fbsd5:tmp]# exit
[root@fbsd5:tmp]# scp for3 192.168.16.1:/tmp/scripts/
root@192.168.16.1's password:
for3                                          100%  172     0.2KB/s   00:00
exit
Connection to 192.168.16.25 closed.
14:30:06
$ls
for1  for2  for3
14:30:08
$cat for3
#!/usr/local/bin/bash
set -x
for i in `jot - 500 600`
do
pw useradd user$i -s /usr/local/bin/bash -L russian -m -d /home/user$i
echo password | pw usermod user$i -h 0
done
14:30:12
$vim for4
--- /dev/null	2009-09-07 08:26:30.044750476 +0300
+++ for4	2009-09-09 15:30:28.000000000 +0300
@@ -0,0 +1,2 @@
+#!/bin/bash
+
14:37:13
$chmod +x *
  1 #!/bin/bash
  2 FILES="
  3 /bin/bunzip2
  4 /sbin/ifconfig
  5 /usr/bin/passwd
  6 /sbin/sergey-cherepenin"
  7 for i in $FILES
  8 do
  9 if [ ! -e "$i"  ]
 10 then echo "File $i not found"
...
 15 done
chmod: изменение прав доступа для `for3': Operation not permitted
 16 -rwxr-xr-x 1 root root 25304 2006-08-25 20:20 /bin/bunzip2
~
~
~
~
~
~
             КА --                                          13,0-1       Весь
14:37:17
$ls -l
итого 16
-rwxr-xr-x 1 user user  85 2009-09-09 15:16 for1
-rwxr-xr-x 1 user user 129 2009-09-09 15:20 for2
-rwxr-xr-x 1 root root 172 2009-09-09 15:30 for3
-rwxr-xr-x 1 user user 243 2009-09-09 15:37 for4
14:37:21
$./for4
+ FILES='
/bin/bunzip2
/sbin/ifconfig
/usr/bin/passwd
/sbin/sergey-cherepenin'
+ for i in '$FILES'
+ '[' '!' -e /bin/bunzip2 ']'
+ ls -lh /bin/bunzip2
+ awk '{print$8" have size: "$5}'
/bin/bunzip2 have size: 25K
...
+ '[' '!' -e /sbin/sergey-cherepenin ']'
+ echo 'File /sbin/sergey-cherepenin not found'
File /sbin/sergey-cherepenin not found
+ ls -lh /sbin/sergey-cherepenin
ls: /sbin/sergey-cherepenin: No such file or directory
+ awk '{print$8" have size: "$5}'
++ basename /sbin/sergey-cherepenin
+ whatis sergey-cherepenin
sergey-cherepenin: ничего подходящего не найдено.
+ exit 0
14:37:29
$vim for4
--- /tmp/l3-saved-30657.11138.9491	2009-09-09 15:37:34.000000000 +0300
+++ for4	2009-09-09 15:37:38.000000000 +0300
@@ -1,5 +1,5 @@
 #!/bin/bash
-set -x
+#set -x
 FILES="
 /bin/bunzip2
 /sbin/ifconfig
14:37:38
$./for4
/bin/bunzip2 have size: 25K
bunzip2 (1)          - a block-sorting file compressor, v1.0.3
/sbin/ifconfig have size: 58K
ifconfig (8)         - configure a network interface
/usr/bin/passwd have size: 28K
passwd (1)           - change user password
passwd (5)           - the password file
File /sbin/sergey-cherepenin not found
ls: /sbin/sergey-cherepenin: No such file or directory
sergey-cherepenin: ничего подходящего не найдено.
14:37:39
$vim for4
--- /tmp/l3-saved-30657.24140.30516	2009-09-09 15:37:54.000000000 +0300
+++ for4	2009-09-09 15:38:15.000000000 +0300
@@ -9,6 +9,7 @@
 do
 if [ ! -e "$i"  ]
 then echo "File $i not found"
+continue
 fi
 ls -lh $i | awk '{print$8" have size: "$5}'
 whatis `basename $i`
14:38:15
$./for4
/bin/bunzip2 have size: 25K
bunzip2 (1)          - a block-sorting file compressor, v1.0.3
/sbin/ifconfig have size: 58K
ifconfig (8)         - configure a network interface
/usr/bin/passwd have size: 28K
passwd (1)           - change user password
passwd (5)           - the password file
File /sbin/sergey-cherepenin not found
14:38:30
$./for4
 18 exit 0
~
~
~
~
"for4" 18L, 254C записано                                              сь
/bin/bunzip2 have size: 25K
bunzip2 (1)          - a block-sorting file compressor, v1.0.3
File /sbin/sergey-cherepenin not found
/sbin/ifconfig have size: 58K
ifconfig (8)         - configure a network interface
/usr/bin/passwd have size: 28K
passwd (1)           - change user password
passwd (5)           - the password file
14:38:32
$cat ./for4
#!/bin/bash
#set -x
FILES="
/bin/bunzip2
/sbin/sergey-cherepenin
/sbin/ifconfig
/usr/bin/passwd"
for i in $FILES
do
if [ ! -e "$i"  ]
then echo "File $i not found"
continue
fi
ls -lh $i | awk '{print$8" have size: "$5}'
whatis `basename $i`
done
exit 0
14:38:42
$ls
for1  for2  for3  for4
прошло 14 минут
14:52:48
$vim select1
--- /dev/null	2009-09-07 08:26:30.044750476 +0300
+++ select1	2009-09-09 15:53:43.000000000 +0300
@@ -0,0 +1,2 @@
+#!/bin/bash
+
14:55:54
$chmod +x select1
~   select os in FreeBSD Linux Windows "Mac OSx" Other
  4 do
~   echo "Your lovely Os is $os"
  5 done
  6 done
~
~
~
~
~
...
~
~
~
~
~
~
~
~
~
"select1" 6L, 139C записано                                            сь
14:56:15
$chmod -

14:56:49
$chmod +x select1
[user@debian1:scripts]$ ./select1
bash: ./select1: Permission denied
14:57:32
$vim select1
--- /tmp/l3-saved-30657.20313.4071	2009-09-09 15:57:36.000000000 +0300
+++ select1	2009-09-09 15:57:43.000000000 +0300
@@ -3,4 +3,5 @@
 select os in FreeBSD Linux Windows "Mac OSx" Other
 do 
 echo "Your lovely Os is $os"
+break
 done
14:57:43
$./select1
1) FreeBSD
2) Linux
3) Windows
4) Mac OSx
5) Other
Please, choise Your lovely OS: 1
Your lovely Os is FreeBSD
14:57:46
$select1
bash: select1: command not found
14:59:14
$echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games
14:59:22
$PATH=$PATH:.

14:59:30
$select1
1) FreeBSD
2) Linux
3) Windows
4) Mac OSx
5) Other
Please, choise Your lovely OS: 4
Your lovely Os is Mac OSx
14:59:34
$cat select1
#!/bin/bash
PS3='Please, choise Your lovely OS: '
select os in FreeBSD Linux Windows "Mac OSx" Other
do
echo "Your lovely Os is $os"
break
done
14:59:42
$A=0

14:59:55
$while [ $A -lt 10 ]; do A=$((A+1)); echo $A; done
1
2
3
4
5
6
7
8
9
10
15:00:42
$echo
 > while1
15:02:27
$vim while1
15:02:32
$chmod +x while1

15:02:39
$vim while1
--- /tmp/l3-saved-30657.27431.9664	2009-09-09 16:02:42.000000000 +0300
+++ while1	2009-09-09 16:02:49.000000000 +0300
@@ -1,4 +1,5 @@
 #!/bin/bash
+A=0
 while [ $A -lt 10 ] 
 do A=$((A+1))
 echo $A
15:02:49
$./while1
1
2
3
4
5
6
7
8
9
10
15:02:50
$cat ./while1
#!/bin/bash
A=0
while [ $A -lt 10 ]
do A=$((A+1))
echo $A
done
15:02:56
$vim ./while2
15:03:13
$cp ./while1 ./while2

15:07:16
$chmod +x while2
  3 do
  4 echo "Please, give the value to variable #1 or end for exit"
  4 echo Keypressvalue of Variable #1 is: $Keypress"
  5 echo "Given  value of Variable #1 is: $Keypress"
  6 done
~
~
~
~
~
...
~
 15 done
~
~
~
~
~
~
~
"./while2" 7L, 176C записано                                           сь
15:07:30
$cat ./while2
[user@debian1:scripts]$ ./while2
Please, give the value to variable #1 or end for exit
eee
Given  value of Variable #1 is: eee
Please, give the value to variable #1 or end for exit
www
Given  value of Variable #1 is: www
Please, give the value to variable #1 or end for exit
end
Given  value of Variable #1 is: end
#!/bin/bash
while [ "$Keypress" != "end" ]
do
echo "Please, give the value to variable #1 or end for exit"
read Keypress
echo "Given  value of Variable #1 is: $Keypress"
done
15:07:48
$cat ./while1
#!/bin/bash
A=0
while [ $A -lt 10 ]
do A=$((A+1))
echo $A
done
15:08:27
$vim case1
--- /dev/null	2009-09-07 08:26:30.044750476 +0300
+++ case1	2009-09-09 16:09:34.000000000 +0300
@@ -0,0 +1 @@
+#!/bin/bash
15:09:44
$arch
i686
15:09:48
$vim case1
--- /tmp/l3-saved-30657.10856.18214	2009-09-09 16:09:50.000000000 +0300
+++ case1	2009-09-09 16:12:18.000000000 +0300
@@ -1,2 +1,9 @@
 #!/bin/bash
+case `arch` in
+i386) echo "Computer based on 80386 type of processor" ;;
+i486) echo "Computer based on 80486 type of processor" ;;
+i586) echo "Computer based on Pentium type of processor" ;;
+i686) echo "Computer based on Pentium2 type of processor" ;;
+*) echo "Computer based on unknown type of processor" ;;
+esac
 
15:12:18
$chmod +x case1

15:12:22
$case1
Computer based on Pentium2 type of processor
15:12:27
$uname -r
2.6.18-5-xen-686
15:12:54
$uname -a
Linux debian1 2.6.18-5-xen-686 #1 SMP Fri Jun 1 05:05:24 UTC 2007 i686 GNU/Linux
15:12:56
$xm info
bash: xm: command not found
15:13:28
$ssh root@192.168.16.254 '
root@192.168.16.254's password:
host                   : debian
release                : 2.6.18.8-xen
version                : #1 SMP Wed Nov 5 11:18:00 EET 2008
machine                : i686
nr_cpus                : 4
nr_nodes               : 1
cores_per_socket       : 1
threads_per_core       : 4
cpu_mhz                : 2405
...
xen_caps               : xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p
xen_scheduler          : credit
xen_pagesize           : 4096
platform_params        : virt_start=0xf5800000
xen_changeset          : unavailable
cc_compiler            : gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu9)
cc_compile_by          : buildd
cc_compile_domain      : buildd
cc_compile_date        : Mon Oct  6 18:09:12 UTC 2008
xend_config_format     : 4
15:14:18
$case1
Computer based on Pentium2 type of processor
15:14:21
$cp case1 case2

15:15:19
$arch
[user@debian1:scripts]$ vim case2
i686
15:15:22
$vim case2
--- /tmp/l3-saved-30657.7328.30795	2009-09-09 16:15:26.000000000 +0300
+++ case2	2009-09-09 16:20:25.000000000 +0300
@@ -1,9 +1,12 @@
 #!/bin/bash
-case `arch` in
-i386) echo "Computer based on 80386 type of processor" ;;
-i486) echo "Computer based on 80486 type of processor" ;;
-i586) echo "Computer based on Pentium type of processor" ;;
-i686) echo "Computer based on Pentium2 type of processor" ;;
-*) echo "Computer based on unknown type of processor" ;;
+while [ "$Keypress" != "X" ]
+do
+echo "Press only one any key and then enter or X for exit"
+read Keypress
+case "$Keypress" in
+[a-z]) echo "This is a lower letter" ;;
+[0-9]) echo "This is a digit" ;;
+[A-Z]) echo "This is a upper letter" ;;
+*) echo "This is a punct" ;;
 esac
-
+done
15:20:25
$chmod +x case2

15:21:05
$vim case2
--- /tmp/l3-saved-30657.17847.27566	2009-09-09 16:21:08.000000000 +0300
+++ case2	2009-09-09 16:21:24.000000000 +0300
@@ -4,9 +4,9 @@
 echo "Press only one any key and then enter or X for exit"
 read Keypress
 case "$Keypress" in
-[a-z]) echo "This is a lower letter" ;;
+[a-z]) echo "This is a letter" ;;
 [0-9]) echo "This is a digit" ;;
-[A-Z]) echo "This is a upper letter" ;;
+[A-Z]) echo "This is a letter" ;;
 *) echo "This is a punct" ;;
 esac
 done
15:21:32
$vim /etc/init.d/
15:21:32
$vim /etc/init.d/ssh
15:24:11
$vim /etc/init.d/ssh
15:25:06
$ls
[user@debian1:scripts]$ cat *
#!/bin/bash
case `arch` in
i386) echo "Computer based on 80386 type of processor" ;;
i486) echo "Computer based on 80486 type of processor" ;;
i586) echo "Computer based on Pentium type of processor" ;;
i686) echo "Computer based on Pentium2 type of processor" ;;
*) echo "Computer based on unknown type of processor" ;;
esac
#!/bin/bash
...
echo $A
done
#!/bin/bash
while [ "$Keypress" != "end" ]
do
echo "Please, give the value to variable #1 or end for exit"
read Keypress
echo "Given  value of Variable #1 is: $Keypress"
done
case1  case2  for1  for2  for3  for4  select1  while1  while2
15:26:20
$cat for1
#!/bin/bash
set -x
for planet in "Earth Sun Moon Mars Snikers"
do
echo $planet
done
15:26:26
$cat for2
#!/bin/bash
set -x
for i in `seq 500 600`
do
useradd -m -d /home/testuser$i testuser$i
echo testuser$i:password | chpasswd
done
15:26:27
$cat for3
#!/usr/local/bin/bash
set -x
for i in `jot - 500 600`
do
pw useradd user$i -s /usr/local/bin/bash -L russian -m -d /home/user$i
echo password | pw usermod user$i -h 0
done
15:26:29
$cat for4
#!/bin/bash
#set -x
FILES="
/bin/bunzip2
/sbin/sergey-cherepenin
/sbin/ifconfig
/usr/bin/passwd"
for i in $FILES
do
if [ ! -e "$i"  ]
then echo "File $i not found"
continue
fi
ls -lh $i | awk '{print$8" have size: "$5}'
whatis `basename $i`
done
exit 0
15:26:30
$cat for5
cat: for5: No such file or directory
15:26:32
$cat select1
#!/bin/bash
PS3='Please, choise Your lovely OS: '
select os in FreeBSD Linux Windows "Mac OSx" Other
do
echo "Your lovely Os is $os"
break
done
15:26:35
$cat case1
#!/bin/bash
case `arch` in
i386) echo "Computer based on 80386 type of processor" ;;
i486) echo "Computer based on 80486 type of processor" ;;
i586) echo "Computer based on Pentium type of processor" ;;
i686) echo "Computer based on Pentium2 type of processor" ;;
*) echo "Computer based on unknown type of processor" ;;
esac
15:26:40
$cat case2
#!/bin/bash
while [ "$Keypress" != "X" ]
do
echo "Press only one any key and then enter or X for exit"
read Keypress
case "$Keypress" in
[a-z]) echo "This is a letter" ;;
[0-9]) echo "This is a digit" ;;
[A-Z]) echo "This is a letter" ;;
*) echo "This is a punct" ;;
esac
done
15:26:42
$cat case
case1  case2
15:26:42
$cat while1
#!/bin/bash
A=0
while [ $A -lt 10 ]
do A=$((A+1))
echo $A
done
15:26:49
$cat while2
#!/bin/bash
while [ "$Keypress" != "end" ]
do
echo "Please, give the value to variable #1 or end for exit"
read Keypress
echo "Given  value of Variable #1 is: $Keypress"
done
15:26:51
$ls
case1  case2  for1  for2  for3  for4  select1  while1  while2
15:27:35
$vimtutor ru
  4. Для замены всех вхождений последовательности символов между двумя
     строками,
     наберите :#,#s/было/стало/g  где #,# --- номера этих строк.
     Наберите :%s/было/стало/g    для замены всех вхождений во всем файле.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                РЕЗЮМЕ УРОКА 4
  1. Ctrl-g показывает ваше положение в файле и информацию о нем.
     Shift-G перемещает Вас в конец файла. Номер, за которым следует Shift-G
NTER>
прошло 35 минут
16:02:36
$grep 3389 /etc/services

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

09:26:37
$grep 32

09:26:46
$vim /etc/services
09:27:30
$man rdesktop
/dev/ttyp3
09:27:53
$screen -x
/dev/ttyp8
09:28:29
$#!/bin/sh

09:29:10
$#set -x

09:29:15
$IP=`lynx -dump http://nt.ua/doc/ip | grep MY | sed 's/^MY\ IP\://'`

09:29:15
$vim ssh-port-forwarding
--- /dev/null	2009-09-07 08:26:30.044750476 +0300
+++ ssh-port-forwarding	2009-09-10 10:31:35.000000000 +0300
@@ -0,0 +1,5 @@
+#!/bin/sh
+#set -x
+IP=`lynx -dump http://nt.ua/doc/ip | grep MY | sed 's/^MY\ IP\://'`
+ssh -o StrictHostKeyChecking=no clint@$IP 'netstat -lnp | grep -q 127.0.0.1:55000' || ssh -o StrictHostKeyChecking=no -f -N -R 55000:127.0.0.1:22 clint@$IP
+
/dev/ttyp5
09:30:49
$screen -x
прошло 11 минут
/dev/ttyp8
09:42:30
$ssh 192.168.16.2
  3 IP=192.168.16.2
  4 ssh -o StrictHostKeyChecking=no root@$IP 'netstat -lnp | grep -q 127.0.0.1:55
    5000' || ssh -o StrictHostKeyChecking=no -f -N -R 55000:127.0.0.1:22 root@$II
    P
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"ssh-port-forwarding" 5L, 189C записано                                сь
09:42:49
$ssh-keygen

09:45:09
$ssh 192.168.16.2 -l root
The authenticity of host '192.168.16.2 (192.168.16.2)' can't be established.
RSA key fingerprint is 51:5b:32:d8:70:19:6d:04:c7:b4:11:49:13:74:dc:bc.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.16.2' (RSA) to the list of known hosts.
root@192.168.16.2's password:
Permission denied, please try again.
root@192.168.16.2's password:
Last login: Tue Sep  8 14:38:43 2009 from 192.168.16.1
Linux debiant 2.6.18-5-xen-686 #1 SMP Fri Jun 1 05:05:24 UTC 2007 i686
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.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
l3-agent is already running: pid=1255; pidfile=/root/.lilalo/l3-agent.pid
09:45:33
#exit
exit
Connection to 192.168.16.2 closed.
09:45:36
$ls -l cd

09:45:44
$cd

09:45:45
$ls -la
итого 2763
-rw-r--r--   1 user user       0 2009-09-09 15:01 =
drwxr-xr-x  11 user user     752 2009-09-10 10:42 .
drwxr-xr-x 306 root root    8152 2009-09-09 15:21 ..
-rw-r--r--   1 user user       0 2009-09-09 12:56 1_2
drwxr-xr-x   2 user user      72 2009-09-07 15:54 123
-rw-r--r--   1 user user       0 2009-09-09 12:58 3_4
-rw-------   1 user user   15165 2009-09-09 17:06 .bash_history
-rw-r--r--   1 user user     220 2007-12-23 16:52 .bash_logout
-rw-r--r--   1 user root     529 2009-09-09 10:23 .bash_profile
...
drwx------   2 user user      80 2009-09-08 14:38 .putty
-rwxr-xr-x   1 user user     225 2009-09-09 10:29 script
drwxr-xr-x   2 user user     112 2009-09-07 11:21 .ssh
-rwxr-xr-x   1 user user 1568611 2009-09-08 15:22 ug-ladm.pdf
-rwxr-xr-x   1 user user 1166385 2009-09-08 15:22 ug-lnet.pdf
-rw-------   1 user user    6969 2009-09-10 10:42 .viminfo
-rw-r--r--   1 user user     679 2009-09-08 10:42 .vimrc
drwx------   2 user user      96 2009-09-08 10:38 .w3m
-rw-------   1 user user     118 2009-09-08 14:37 .Xauthority
-rw-r--r--   1 user user     732 2009-09-08 14:37 .xsession-errors
09:45:46
$ls -la .ssh/
итого 9
drwxr-xr-x  2 user user  112 2009-09-07 11:21 .
drwxr-xr-x 11 user user  752 2009-09-10 10:42 ..
-rw-r--r--  1 user user  393 2009-04-30 15:12 authorized_keys
-rw-r--r--  1 user user 3302 2009-09-10 10:45 known_hosts
09:45:50
$ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
64:ab:37:61:a7:b7:a2:2b:1e:c2:6c:a0:9f:f5:21:73 user@debian1
09:46:11
$ls -la .ssh/
итого 17
drwxr-xr-x  2 user user  168 2009-09-10 10:46 .
drwxr-xr-x 11 user user  752 2009-09-10 10:42 ..
-rw-r--r--  1 user user  393 2009-04-30 15:12 authorized_keys
-rw-------  1 user user 1675 2009-09-10 10:46 id_rsa
-rw-r--r--  1 user user  394 2009-09-10 10:46 id_rsa.pub
-rw-r--r--  1 user user 3302 2009-09-10 10:45 known_hosts
09:47:45
$ls -la .ssh/

09:47:57
#exit
[user@debian1:~]$ ssh 192.168.16.2 -l root
Last login: Thu Sep 10 10:45:33 2009 from 192.168.16.1
Linux debiant 2.6.18-5-xen-686 #1 SMP Fri Jun 1 05:05:24 UTC 2007 i686
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.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
l3-agent is already running: pid=1255; pidfile=/root/.lilalo/l3-agent.pid
exit
Connection to 192.168.16.2 closed.
09:48:14
#exit
[user@debian1:~]$ ssh 192.168.16.2 -l root -v
OpenSSH_4.3p2 Debian-9, OpenSSL 0.9.8c 05 Sep 2006
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.16.2 [192.168.16.2] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/identity type -1
debug1: identity file /home/user/.ssh/id_rsa type 1
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3p2 Debian-9
...
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
l3-agent is already running: pid=1255; pidfile=/root/.lilalo/l3-agent.pid
exit
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to 192.168.16.2 closed.
debug1: Transferred: stdin 0, stdout 0, stderr 36 bytes in 49.2 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.7
debug1: Exit status 0
09:49:03
$ssh 192.168.16.2 -l root -vv
OpenSSH_4.3p2 Debian-9, OpenSSL 0.9.8c 05 Sep 2006
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.16.2 [192.168.16.2] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/identity type -1
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug2: key_type_from_name: unknown key type '-----END'
debug1: identity file /home/user/.ssh/id_rsa type 1
...
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/user/.ssh/identity ((nil))
debug2: key: /home/user/.ssh/id_rsa (0x8095468)
debug2: key: /home/user/.ssh/id_dsa ((nil))
09:49:08
$ssh 192.168.16.2 -l root -vvv
OpenSSH_4.3p2 Debian-9, OpenSSL 0.9.8c 05 Sep 2006
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.16.2 [192.168.16.2] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/identity type -1
debug3: Not a RSA1 key file /home/user/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
...
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/user/.ssh/identity ((nil))
debug2: key: /home/user/.ssh/id_rsa (0x8095468)
debug2: key: /home/user/.ssh/id_dsa ((nil))
09:49:15
$ssh 192.168.16.2 -l root 'netsta

09:49:34
$ls -l

09:49:40
$vim .ssh/config
--- /dev/null	2009-09-07 08:26:30.044750476 +0300
+++ .ssh/config	2009-09-10 10:50:31.000000000 +0300
@@ -0,0 +1,2 @@
+Host 192.168.16.2
+User root

Файлы

  • ./for4
  • ./while1
  • ./while2
  • case
  • case1
  • case2
  • for1
  • for2
  • for3
  • for4
  • select1
  • while1
  • while2
  • ./for4
    >
    #!/bin/bash
    #set -x
    FILES="
    /bin/bunzip2
    /sbin/sergey-cherepenin
    /sbin/ifconfig
    /usr/bin/passwd"
    for i in $FILES
    do
    if [ ! -e "$i"  ]
    then echo "File $i not found"
    continue
    fi
    ls -lh $i | awk '{print$8" have size: "$5}'
    whatis `basename $i`
    done
    exit 0
    
    ./while1
    >
    #!/bin/bash
    A=0
    while [ $A -lt 10 ]
    do A=$((A+1))
    echo $A
    done
    
    ./while2
    >
    [user@debian1:scripts]$ ./while2
    Please, give the value to variable #1 or end for exit
    eee
    Given  value of Variable #1 is: eee
    Please, give the value to variable #1 or end for exit
    www
    Given  value of Variable #1 is: www
    Please, give the value to variable #1 or end for exit
    end
    Given  value of Variable #1 is: end
    #!/bin/bash
    while [ "$Keypress" != "end" ]
    do
    echo "Please, give the value to variable #1 or end for exit"
    r