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

Содержание

Журнал

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

/dev/pts/21
13:57:18
#=)
bash: syntax error near unexpected token `)'
/dev/pts/1
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
/dev/pts/1
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";
14:02:08
#cat /home/quiz/start-quiz|less
14:02:59
#cat /home/quiz
cat: /home/quiz: Это каталог
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'
прошло 14 минут
/dev/pts/21
14:17:23
#nc 192.168.15.1 110

14:17:23
#netstat -lnp -A inet

14:17:23
#netstat -lnp -A inet
                     ыÐ# =)
/dev/pts/1
14:19:54
#ssh 192.168.15.12
ssh: connect to host 192.168.15.12 port 22: Connection refused
/dev/pts/15
14:20:32
#vi /etc/ssh/sshd_config
14:21:02
#/etc/init.d/ssh restart
Restarting OpenBSD Secure Shell server: sshd.
14:21:07
#exit
exit
Connection to 192.168.15.1 closed.
/dev/pts/1
14:21:23
#screen -x
/dev/pts/6
14:29:46
#ьфт ыыр
bash: ьфт: команда не найдена
14:29:48
#man ssh
14:30:06
#screen -x
/dev/pts/11
14:30:08
#screen -x
/dev/pts/21
14:30:14
#ыыcat /etc/ssh/sshd_config
# Package generated configuration file
# See the sshd(8) manpage for details
# What ports, IPs and protocols we listen for
Port 22222
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
...
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
/dev/pts/20
14:30:24
#screen -x
/dev/pts/31
14:30:48
#screen -x
/dev/pts/15
14:31:19
#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'
14:33:09
#ssh -w 0Ð:92.168.16.1:192.168.16.2 -N -f 192.168.15.1
Bad tun device '0:192.168.16.1:192.168.16.2'
14:33:50
#ssh -w 0 -N -f 192.168.15.1
Enter passphrase for key '/root/.ssh/id_dsa':
channel 0: open failed: administratively prohibited: open failed
14:34:02
#ssh 192.168.15.1
Enter passphrase for key '/root/.ssh/id_dsa':
l3-agent is already running: pid=4276; pidfile=/root/.lilalo/l3-agent.pid
/dev/pts/21
14:34:50
#getent 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
...
bea:x:1013:1013::/home/bea:/bin/sh
beckie:x:1014:1014::/home/beckie:/bin/sh
becky:x:1015:1015::/home/becky:/bin/sh
behdad:x:1016:1016::/home/behdad:/bin/sh
belinda:x:1017:1017::/home/belinda:/bin/sh
ben:x:1018:1018::/home/ben:/bin/sh
benjamin:x:1019:1019::/home/benjamin:/bin/sh
benny:x:1020:1020::/home/benny:/bin/sh
benson:x:1021:1021::/home/benson:/bin/sh
bernard:x:1022:1022::/home/bernard:/bin/sh
14:34:54
#exit
exit
Connection to linux1 closed.
/dev/pts/15
14:35:12
#ssh -w 0 -N -f 192.168.15.1
Enter passphrase for key '/root/.ssh/id_dsa':
14:35:17
#ifconfig
dummy0    Link encap:Ethernet  HWaddr a2:95:80:44:21:2b
          inet addr:1.2.3.4  Bcast:1.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::a095:80ff:fe44:212b/64 Scope:Link
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1257 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:40224 (39.2 KiB)
eth0      Link encap:Ethernet  HWaddr 00:16:3e:04:00:12
          inet addr:10.0.35.100  Bcast:10.255.255.255  Mask:255.0.0.0
...
          collisions:0 txqueuelen:1000
          RX bytes:78254616 (74.6 MiB)  TX bytes:148269989 (141.4 MiB)
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1606 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1606 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:79590 (77.7 KiB)  TX bytes:79590 (77.7 KiB)
14:35:19
#ifconfig -a | less
14:35:32
#ifconfig tun0 192.168.16.1

14:35:47
#ping 192.168.16.1
PING 192.168.16.1 (192.168.16.1) 56(84) bytes of data.
64 bytes from 192.168.16.1: icmp_seq=1 ttl=64 time=0.015 ms
--- 192.168.16.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.015/0.015/0.015/0.000 ms
14:35:53
#ssh -w 1:192.168.17.1 -N -f 192.168.15.1
Bad tun device '1:192.168.17.1'
/dev/pts/21
14:36:23
#cat /etc/ssh/sshd_config |less
14:36:42
#alias exit='echo no exit'

/dev/pts/15
14:36:57
#ssh -w 1 192.168.17.1 -N -f 192.168.15.1

/dev/pts/33
14:39:14
#cat /etc/ssh/ssh
ssh_config            sshd_config           ssh_host_dsa_key      ssh_host_dsa_key.pub  ssh_host_rsa_key      ssh_host_rsa_key.pub
14:39:14
#cat /etc/ssh/sshd_config
# Package generated configuration file
# See the sshd(8) manpage for details
# What ports, IPs and protocols we listen for
Port 22222
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
...
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
/dev/pts/21
14:46:54
#set -o ignoreeof

14:46:59
#zless /usr/share/dict/propernames | head -100 | tail -20
Avery
Axel
Barbara
Barbra
Barney
Barrett
Barrio
Barry
Bart
Barton
Bea
Beckie
Becky
Behdad
Belinda
Ben
Benjamin
Benny
Benson
Bernard
14:47:20