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

Содержание

Журнал

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

/dev/pts/9
13:35:12
#nc --?
nc: invalid option -- '-'
nc -h for help
13:35:19
#man nc
/dev/pts/20
13:41:17
#scp quiz@10.0.35.100:~/quiz /root/b
Host key fingerprint is 69:b5:3e:1a:9a:b7:c3:c3:96:03:c7:b7:b4:69:1d:3b
+--[ RSA 2048]----+
|                 |
|                 |
|          .      |
|         o .     |
|       .S .      |
|      ..o.o .    |
|       =.+o= o   |
|       oXo=.E    |
|      ooo*   .   |
+-----------------+
quiz@10.0.35.100's password:
13:42:40
#scp quiz@10.0.35.100:~/quiz /root/new
Host key fingerprint is 69:b5:3e:1a:9a:b7:c3:c3:96:03:c7:b7:b4:69:1d:3b
+--[ RSA 2048]----+
|                 |
|                 |
|          .      |
|         o .     |
|       .S .      |
|      ..o.o .    |
|       =.+o= o   |
|       oXo=.E    |
|      ooo*   .   |
+-----------------+
quiz@10.0.35.100's password:
TERM environment variable not set.
Can't open -c: Нет такого файла или каталога at /usr/local/bin/quiz line 34.
Can't open scp -f ~/quiz: Нет такого файла или каталога at /usr/local/bin/quiz line 34.
----------------------------------------------------------------------
TERM environment variable not set.
13:42:51
#scp quiz@10.0.35.100:/home/quiz/* /root/new
Host key fingerprint is 69:b5:3e:1a:9a:b7:c3:c3:96:03:c7:b7:b4:69:1d:3b
+--[ RSA 2048]----+
|                 |
|                 |
|          .      |
|         o .     |
|       .S .      |
|      ..o.o .    |
|       =.+o= o   |
|       oXo=.E    |
|      ooo*   .   |
+-----------------+
quiz@10.0.35.100's password:
TERM environment variable not set.
Can't open -c: Нет такого файла или каталога at /usr/local/bin/quiz line 34.
Can't open scp -f /home/quiz/*: Нет такого файла или каталога at /usr/local/bin/quiz line 34.
TERM environment variable not set.
----------------------------------------------------------------------
13:43:13
#ssh 10.0.35.100
Host key fingerprint is 69:b5:3e:1a:9a:b7:c3:c3:96:03:c7:b7:b4:69:1d:3b
+--[ RSA 2048]----+
|                 |
|                 |
|          .      |
|         o .     |
|       .S .      |
|      ..o.o .    |
|       =.+o= o   |
|       oXo=.E    |
...
root@10.0.35.100's password:
Linux linux0 2.6.18-6-xen-686 #1 SMP Sun Feb 10 22:43:13 UTC 2008 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.
Last login: Wed Jun  3 13:14:39 2009 from linux14.unix.nt
Agent pid 13439
l3-agent is already running: pid=1854; pidfile=/root/.lilalo/l3-agent.pid
13:44:30
#scp 10.0.35.100:/home/quiz/quiz3 /root/new
Host key fingerprint is 69:b5:3e:1a:9a:b7:c3:c3:96:03:c7:b7:b4:69:1d:3b
+--[ RSA 2048]----+
|                 |
|                 |
|          .      |
|         o .     |
|       .S .      |
|      ..o.o .    |
|       =.+o= o   |
|       oXo=.E    |
|      ooo*   .   |
+-----------------+
root@10.0.35.100's password:
scp: /home/quiz/quiz3: not a regular file
13:44:56
#scp 10.0.35.100:/home/quiz/quiz3/* /root/new
Host key fingerprint is 69:b5:3e:1a:9a:b7:c3:c3:96:03:c7:b7:b4:69:1d:3b
+--[ RSA 2048]----+
|                 |
|                 |
|          .      |
|         o .     |
|       .S .      |
|      ..o.o .    |
|       =.+o= o   |
|       oXo=.E    |
...
192.168.15.16-1243688014.log                  100%   26KB  25.7KB/s   00:00
192.168.15.2-1243688037.log                   100%   26KB  25.7KB/s   00:00
192.168.15.253-1243688231.log                 100%   26KB  25.6KB/s   00:00
192.168.15.3-1243688017.log                   100%   26KB  25.7KB/s   00:00
192.168.15.4-1243688036.log                   100%   26KB  25.7KB/s   00:00
192.168.15.5-1243688193.log                   100%   26KB  25.7KB/s   00:00
192.168.15.6-1243688038.log                   100%   26KB  25.7KB/s   00:00
192.168.15.7-1243688056.log                   100%   26KB  25.7KB/s   00:00
192.168.15.8-1243688088.log                   100%   26KB  25.7KB/s   00:00
192.168.15.9-1243688025.log                   100%   26KB  25.7KB/s   00:00
13:45:06
#cd /root/new
bash: cd: /root/new: Это не каталог
13:45:29
#cd /root

13:45:32
#ls
a  etc.iso  flash  new  screen.dot  screen.png  vimrc
13:45:33
#cat new
 суммы установленных в системе deb-пакетов?
 1. apt-get
 2. debsum
 3. dpkg
 4. sumdeb
 5. md5dev
 6. bc
 7. debmd5
 8. cat
@1243690202
...
 У вас есть сто пакетов в текущем каталоге,
 которые вы хотите добавить в кэш approx.
 Можно ли это как-то сделать?
 1. Да, для этого просто достаточно скопировать все пакеты в кэш
 2. Да, для этого есть специальная программа approx-import
 3. Нет, нельзя
 4. Эти пакеты уже всё равно обновились, и вообще, что за вопросы? Вы в кэш сквида картинки тоже добавляете?
@1243690680
#40
--- 3 (2)
13:45:36
#cat new|less
13:46:09
#rm new

13:46:37
#mkdir new

13:46:41
#scp 10.0.35.100:/home/quiz/quiz3/* /root/new/
Host key fingerprint is 69:b5:3e:1a:9a:b7:c3:c3:96:03:c7:b7:b4:69:1d:3b
+--[ RSA 2048]----+
|                 |
|                 |
|          .      |
|         o .     |
|       .S .      |
|      ..o.o .    |
|       =.+o= o   |
|       oXo=.E    |
...
192.168.15.16-1243688014.log                  100%   26KB  25.7KB/s   00:00
192.168.15.2-1243688037.log                   100%   26KB  25.7KB/s   00:00
192.168.15.253-1243688231.log                 100%   26KB  25.6KB/s   00:00
192.168.15.3-1243688017.log                   100%   26KB  25.7KB/s   00:00
192.168.15.4-1243688036.log                   100%   26KB  25.7KB/s   00:00
192.168.15.5-1243688193.log                   100%   26KB  25.7KB/s   00:00
192.168.15.6-1243688038.log                   100%   26KB  25.7KB/s   00:00
192.168.15.7-1243688056.log                   100%   26KB  25.7KB/s   00:00
192.168.15.8-1243688088.log                   100%   26KB  25.7KB/s   00:00
192.168.15.9-1243688025.log                   100%   26KB  25.7KB/s   00:00
13:46:47
#cd new

13:46:50
#ls
192.168.15.10-1243688058.log  192.168.15.253-1243688231.log
192.168.15.11-1243688015.log  192.168.15.3-1243688017.log
192.168.15.1-1243688040.log   192.168.15.4-1243688036.log
192.168.15.12-1243688039.log  192.168.15.5-1243688193.log
192.168.15.13-1243688017.log  192.168.15.6-1243688038.log
192.168.15.14-1243688128.log  192.168.15.7-1243688056.log
192.168.15.15-1243688022.log  192.168.15.8-1243688088.log
192.168.15.16-1243688014.log  192.168.15.9-1243688025.log
192.168.15.2-1243688037.log
13:46:51
#cat 192.168.15.13-1243688017.log |less
13:49:48
#rm /root/new/*

13:50:06
#ls
quiz
13:50:09
#cat quiz
# 0.1 час
После того как crontab был изменён, для того чтобы его перечитать,
нужно ли перезапускать cron, и если нужно, то как?
# /etc/init.d/crond restart
# /etc/init.d/crontab restart
# /etc/init.d/crontab reload
# pkill -1 cron
# pkill -1 crond
#! Нет, не нужно перезапускать, crontab и так перечитывается
Что обозначает символ % в команде в crontab?
...
# strace `which prg`
#! ldd `which prg`
# strings `which prg'
# strace 'which prg'
Как получить полный список файлов, которые процесс 1234 открывает в ходе своей работы
(не только, которые открыты сейчас).
#! strace -p 1234 -o /tmp/1234.strace; grep open /tmp/1234.strace
#* lsof -p 1234
# strings `which 1234`
# strings 'which 1234'
13:50:12
#rm *

/dev/pts/20
13:54:51
#cd /home/new
bash: cd: /home/new: Нет такого файла или каталога
13:55:05
#cd /root/new

13:55:16
#ls

/dev/pts/20
13:57:44
#ls -l
итого 3324
drwxr-xr-x 2 root root    4096 Май 25 16:40 17179869184
drwxr-xr-x 2 root root    4096 Май 25 16:40 345448
drwxr-xr-x 2 root root    4096 Май 25 16:40 345789358
-rw-r--r-- 1 root root       0 Май 29 14:52 ABCABCf
-rw-r--r-- 1 root root       0 Май 29 14:50 ABCABC:gff
-rw-r--r-- 1 root root       0 Май 29 14:50 ABCfff
drwxr-xr-x 2 root root    4096 Июн  3 11:51 bin
-rw-r--r-- 1 root root 3024896 Июн  1 10:34 etc.iso
-rw-r--r-- 1 root root       0 Май 26 18:22 F
...
-rw-r--r-- 1 root root       0 Май 26 18:22 F.7
-rw-r--r-- 1 root root       0 Май 26 18:22 F.8
-rw-r--r-- 1 root root       0 Май 26 18:22 F.9
-rw-r--r-- 1 root root       0 Май 29 14:50 ffff
-rw-r--r-- 1 root root       0 Май 29 14:52 fffffff
-rw-r--r-- 1 root root      12 Май 25 14:47 file
-rw-r--r-- 1 root root   54606 Май 29 10:24 iceweasel.dot
-rw-r--r-- 1 root root      12 Май 25 14:47 last-ping
-rw-r--r-- 1 root root    4737 Май 29 10:19 screen.dot
-rw-r--r-- 1 root root  271894 Май 29 10:20 screen.png
13:57:49
#ls -l|less
13:57:59
#cd /home

13:58:05
#ls
approx  quiz  user  user1  user2  user3  userX  userY
13:58:06
#cd quiz

13:58:09
#ls
quiz  quiz2  quiz3  start-quiz
13:58:10
#exit
exit
Connection to 10.0.35.100 closed.
/dev/pts/9
13:58:58
#exit
192.168.15.2: exit
Connection to 192.168.15.2 closed.
192.168.15.3: Linux linux3 2.6.29-2-686 #1 SMP Sun May 17 17:56:29 UTC 2009 i686
192.168.15.3:
192.168.15.3: The programs included with the Debian GNU/Linux system are free software;
192.168.15.3: the exact distribution terms for each program are described in the
192.168.15.3: individual files in /usr/share/doc/*/copyright.
192.168.15.3:
192.168.15.3: Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
192.168.15.3: permitted by applicable law.
192.168.15.3: Last login: Wed Jun  3 10:58:16 2009 from linux5.unix.nt
192.168.15.3:
192.168.15.3: l3-agent is already running: pid=3235; pidfile=/root/.lilalo/l3-agent.pid
/dev/pts/20
14:01:32
#ls /home/quiz
quiz  quiz2  quiz3  start-quiz
14:01:39
#cat start-quiz
cat: start-quiz: Нет такого файла или каталога
14:01:47
#cd start-quiz
bash: cd: start-quiz: Нет такого файла или каталога
14:01:54
#cat /home/quiz/start-quiz
#!/usr/bin/perl
$id = $ENV{"SSH_CLIENT"};
$id = (split(/\s+/, $id))[0];
if ($id) { $id .= "-"};
$quiz_file = "quiz";
$log_file = ".quiz/$id".time().'.log';
@Questions = ();
$Score = 0;
sub ask_question($)
{
...
    }
    else {
        $question .= $_;
    };
}
close(QUIZ);
for $question (@Questions) {
    $Score += ask_question($question);
}
print "Your score: $Score\n";
/dev/pts/20
14:02:06
#cd /root

/dev/pts/20
14:02:08
#cat /home/quiz/start-quiz|less
/dev/pts/20
14:02:15
#ls
a  etc.iso  flash  new  screen.dot  screen.png  vimrc
14:02:16
#find / -name quiz
/home/quiz
14:02:51
#cd /home

14:02:55
#ls
aaron  ada  dom  quiz  user  user1  user2  uuu
14:02:57
#cd quiz

/dev/pts/20
14:02:59
#cat /home/quiz
cat: /home/quiz: Это каталог
/dev/pts/20
14:02:59
#ls

14:03:00
#cd ..

14:03:04
#rm -R quiz

/dev/pts/20
14:03:07
#cat /home/quiz/
.bash_history  .hushlogin.10  .hushlogin.6   quiz           .ssh/
.bash_logout   .hushlogin.2   .hushlogin.7   .quiz/         start-quiz
.bashrc        .hushlogin.3   .hushlogin.8   .quiz1/        .viminfo
.hushlogin     .hushlogin.4   .hushlogin.9   quiz2/
.hushlogin.1   .hushlogin.5   .profile       quiz3/
14:03:07
#cat /home/quiz/quiz
# 0.1 час
После того как crontab был изменён, для того чтобы его перечитать,
нужно ли перезапускать cron, и если нужно, то как?
# /etc/init.d/crond restart
# /etc/init.d/crontab restart
# /etc/init.d/crontab reload
# pkill -1 cron
# pkill -1 crond
#! Нет, не нужно перезапускать, crontab и так перечитывается
Что обозначает символ % в команде в crontab?
...
# strace `which prg`
#! ldd `which prg`
# strings `which prg'
# strace 'which prg'
Как получить полный список файлов, которые процесс 1234 открывает в ходе своей работы
(не только, которые открыты сейчас).
#! strace -p 1234 -o /tmp/1234.strace; grep open /tmp/1234.strace
#* lsof -p 1234
# strings `which 1234`
# strings 'which 1234'
/dev/pts/20
14:03:09
#ls
aaron  ada  dom  user  user1  user2  uuu
/dev/pts/20
14:03:17
#exit
exit
Connection to 10.0.35.100 closed.
/dev/pts/9
14:06:01
#ssh -w 192.168.16.1:192.168.16.2 -N -f 192.168.15.1
Bad tun device '192.168.16.1:192.168.16.2'
прошло 13 минут
14:19:04
#ssh -w 0 -N -f 192.168.15.1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
54:b6:4e:a0:18:a4:c1:b1:8f:f5:64:59:31:ba:63:f5.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:7
RSA host key for 192.168.15.1 has changed and you have requested strict checking.
Host key verification failed.
14:20:22
#cd /tmp/; ssh linux1 tar c /etc | tar x
The authenticity of host 'linux1 (192.168.15.1)' can't be established.
RSA key fingerprint is 54:b6:4e:a0:18:a4:c1:b1:8f:f5:64:59:31:ba:63:f5.
+--[ RSA 2048]----+
| .ooo   =.o      |
|  .+ o = = .     |
|  o o * o o      |
|   + + + +       |
|  . . = S E      |
|     . .         |
|                 |
...
+-----------------+
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'linux1' (RSA) to the list of known hosts.
Warning: the RSA host key for 'linux1' differs from the key for the IP address '192.168.15.1'
Offending key for IP in /root/.ssh/known_hosts:7
Are you sure you want to continue connecting (yes/no)? yes
root@linux1's password:
Permission denied, please try again.
root@linux1's password:
tar: Удаляется начальный `/' из имен объектов