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

Содержание

Журнал

Среда (01/13/10)

/dev/ttyp8
10:25:54
#vim /etc/passwd
10:27:23
#useradd -d /home/adduser -s /bin/bash useradd
[root@debian1:tmp]# useradd useradd -h /home/adduser -s /bin/bash
useradd: invalid option -- h
Usage: useradd [options] LOGIN
Options:
  -b, --base-dir BASE_DIR       base directory for the new user account
                                home directory
  -c, --comment COMMENT         set the GECOS field for the new user account
  -d, --home-dir HOME_DIR       home directory for the new user account
  -D, --defaults                print or save modified default useradd
                                configuration
...
  -K, --key KEY=VALUE           overrides /etc/login.defs defaults
  -m, --create-home             create home directory for the new user
                                account
  -o, --non-unique              allow create user with duplicate
                                (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new user
                                account
  -r, --system                  create a system account
  -s, --shell SHELL             the login shell for the new user account
  -u, --uid UID                 force use the UID for the new user account
10:27:50
#vim /etc/shadow
10:28:21
#useradd -d /home/adduser -s /bin/bash useradd2 -G root
[root@debian1:tmp]# useradd --help
Usage: useradd [options] LOGIN
Options:
  -b, --base-dir BASE_DIR       base directory for the new user account
                                home directory
  -c, --comment COMMENT         set the GECOS field for the new user account
  -d, --home-dir HOME_DIR       home directory for the new user account
  -D, --defaults                print or save modified default useradd
                                configuration
  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
...
  -K, --key KEY=VALUE           overrides /etc/login.defs defaults
  -m, --create-home             create home directory for the new user
                                account
  -o, --non-unique              allow create user with duplicate
                                (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new user
                                account
  -r, --system                  create a system account
  -s, --shell SHELL             the login shell for the new user account
  -u, --uid UID                 force use the UID for the new user account
10:28:53
#useradd -d /home/adduser -s /bin/bash useradd3 -g root
[root@debian1:tmp]# id useradd2
uid=1307(useradd2) gid=1307(useradd2) groups=1307(useradd2),0(root)
10:29:18
#id useradd3
uid=1308(useradd3) gid=0(root) groups=0(root)
10:29:43
#[root@fbsd3:~]# vim /etc/passwd
  5 daemon:*:1:1:Owner of many system processes:/root:/usr/sbin/nologin
  6 operator:*:2:5:System &:/:/usr/sbin/nologin
  7 bin:*:3:7:Binaries Commands and Source:/:/usr/sbin/nologin
  8 tty:*:4:65533:Tty Sandbox:/:/usr/sbin/nologin
  9 kmem:*:5:65533:KMem Sandbox:/:/usr/sbin/nologin
    /nologin7:13:Games pseudo-user:/usr/games:/usr/sbin/nologin
    inilnull:*:26:26:Sendmail Default User:/var/spool/mqueue:/usr/sbin/nologg
 16 bind:*:53:53:Bind Sandbox:/:/usr/sbin/nologinr/sbin/nologin
 17 proxy:*:62:62:Packet Filter pseudo-user:/nonexistent:/usr/sbin/nologin
 18 _pflogd:*:64:64:pflogd privsep user:/var/empty:/usr/sbin/nologinusr/sbinn
 19 _dhcp:*:65:65:dhcp programs:/var/empty:/usr/sbin/nologin
10:30:48
#[root@fbsd3:~]# man master.passwd
d
     replaced by a `*' character.
e
     uid field is the number associated with it.  They should both be unique
     across the system (and often across a group of systems) since they con-
     trol file access.
s
     and/or identical user id's, it is usually a mistake to do so.  Routines
     that manipulate these files will often return only one of the multiple
/dev/ttyp0
10:30:52
#ls -ld
 34 sasl:x:45:
 35 plugdev:x:46:
 36 staff:x:50:
 37 games:x:60:
 38 users:x:100:
 39 nogroup:x:65534:
 40 crontab:x:101:
 41 ssh:x:102:
 42 gdm:x:103:
 43 user:x:1000:
drwxr-xr-x 57 root root 3528 2010-01-13 11:30 .
/dev/ttyp8
10:31:19
#[root@fbsd3:~]# adduser
Full Name  : Add User
Uid        : 1103
Class      : russian
Groups     : adduser wheel
Home       : /home/adduser
Shell      : /usr/local/bin/bash
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (adduser) to the user database.
Add another user? (yes/no): no
Goodbye!
10:32:44
#[root@fbsd3:~]# vi /etc/passwd
user581:*:1083:1083:User &:/home/user581:/usr/local/bin/bash
user582:*:1084:1084:User &:/home/user582:/usr/local/bin/bash
user583:*:1085:1085:User &:/home/user583:/usr/local/bin/bash
user584:*:1086:1086:User &:/home/user584:/usr/local/bin/bash
user585:*:1087:1087:User &:/home/user585:/usr/local/bin/bash
user586:*:1088:1088:User &:/home/user586:/usr/local/bin/bash
user587:*:1089:1089:User &:/home/user587:/usr/local/bin/bash
user588:*:1090:1090:User &:/home/user588:/usr/local/bin/bash
user589:*:1091:1091:User &:/home/user589:/usr/local/bin/bash
user590:*:1092:1092:User &:/home/user590:/usr/local/bin/bash
...
user593:*:1095:1095:User &:/home/user593:/usr/local/bin/bash
user594:*:1096:1096:User &:/home/user594:/usr/local/bin/bash
user595:*:1097:1097:User &:/home/user595:/usr/local/bin/bash
user596:*:1098:1098:User &:/home/user596:/usr/local/bin/bash
user597:*:1099:1099:User &:/home/user597:/usr/local/bin/bash
user598:*:1100:1100:User &:/home/user598:/usr/local/bin/bash
user599:*:1101:1101:User &:/home/user599:/usr/local/bin/bash
user600:*:1102:1102:User &:/home/user600:/usr/local/bin/bash
adduser:*:1103:1103:Add User:/home/adduser:/usr/local/bin/bash
:q!
10:32:54
#[root@fbsd3:~]#

10:32:55
#[root@fbsd3:~]#

10:32:55
#[root@fbsd3:~]#

10:33:31
#[root@fbsd3:~]#
[root@fbsd3:~]#
10:33:31
#[root@fbsd3:~]#

10:33:32
#[root@fbsd3:~]# pw
usage:
  pw [user|group|lock|unlock] [add|del|mod|show|next] [help|switches/values]
10:33:50
#[root@fbsd3:~]# pw user add useradd -l Russian -s /usr/local/bin/bash
[root@fbsd3:~]# pw user add help
usage: pw useradd [name] [switches]
        -V etcdir      alternate /etc location
        -C config      configuration file
        -q             quiet operation
  Adding users:
        -n name        login name
        -u uid         user id
        -c comment     user name/comment
        -d directory   home directory
...
        -L class       default user class
        -k dir         default home skeleton
        -M mode        home directory permissions
        -u min,max     set min,max uids
        -i min,max     set min,max gids
        -w method      set default password method
        -s shell       default shell
        -y path        set NIS passwd file path
pw: illegal option -- l
pw: unknown switch
10:34:22
#[root@fbsd3:~]# pw user add useradd -L Russian -s /usr/local/bin/bash

10:34:38
#[root@fbsd3:~]# vim /etc/passwd
121 user592:*:1094:1094:User &:/home/user592:/usr/local/bin/bash
122 user593:*:1095:1095:User &:/home/user593:/usr/local/bin/bash
123 user594:*:1096:1096:User &:/home/user594:/usr/local/bin/bash
124 user595:*:1097:1097:User &:/home/user595:/usr/local/bin/bash
125 user596:*:1098:1098:User &:/home/user596:/usr/local/bin/bash
126 user597:*:1099:1099:User &:/home/user597:/usr/local/bin/bash
127 user598:*:1100:1100:User &:/home/user598:/usr/local/bin/bash
128 user599:*:1101:1101:User &:/home/user599:/usr/local/bin/bash
129 user600:*:1102:1102:User &:/home/user600:/usr/local/bin/bash
130 adduser:*:1103:1103:Add User:/home/adduser:/usr/local/bin/bash
131 useradd:*:1104:1104:User &:/home/useradd:/usr/local/bin/bash
10:36:09
#[root@fbsd3:~]# vim /etc/master.passwd
    /home/user593:/usr/local/bin/bashZMkMqc/z0:1095:1095:russian:0:0:User &::
    /home/user594:/usr/local/bin/bashcZ.s2Pkt/:1096:1096:russian:0:0:User &::
    /home/user595:/usr/local/bin/bashXWMw9n/D/:1097:1097:russian:0:0:User &::
    /home/user596:/usr/local/bin/bashdP5vr3ww.:1098:1098:russian:0:0:User &::
    /home/user597:/usr/local/bin/basho52welHV0:1099:1099:russian:0:0:User &::
    /home/user598:/usr/local/bin/bashiP0JtadA1:1100:1100:russian:0:0:User &::
    /home/user599:/usr/local/bin/bash.TNdBVh.1:1101:1101:russian:0:0:User &::
    /home/user600:/usr/local/bin/bashtPL2KYx6/:1102:1102:russian:0:0:User &::
    r:/home/adduser:/usr/local/bin/bashBe4PiR/:1103:1103:russian:0:0:Add Usee
    useradd:$1$4D0NaRKu$FAUd3sCy6QMEh1G6k2Da
    /home/useradd:/usr/local/bin/bash1G6k2Dau/:1104:1104:Russian:0:0:User &::
~
10:36:32
#[root@fbsd3:~]#
 12 man:*:9:
"/etc/group" 137L, 2124C
 13 games:*:13:
 14 staff:*:20:
 15 sshd:*:22:
 16 smmsp:*:25:
 17 mailnull:*:26:
 18 guest:*:31:
 19 bind:*:53:
 20 proxy:*:62:
 21 authpf:*:63:
 22 _pflogd:*:64:
10:36:32
#[root@fbsd3:~]#

10:36:32
#[root@fbsd3:~]#

10:36:48
#[root@fbsd3:~]# pw userdel -r useradd
[root@fbsd3:~]# pw userdel help
usage: pw userdel [uid|name] [switches]
        -V etcdir      alternate /etc location
        -n name        login name
        -u uid         user id
        -Y             update NIS maps
        -r             remove home & contents
pw: user name or id required
10:37:24
#[root@fbsd3:~]# pw userdel -u useradd -r
[root@fbsd3:~]# pw userdel -r -u useradd
pw: cannot remove user 'root'
pw: cannot remove user 'root'
10:37:49
#[root@fbsd3:~]# ls /usr/home/user
[root@fbsd3:~]# pw userdel useradd -r
Display all 102 possibilities? (y or n)
10:37:49
#[root@fbsd3:~]# ls /usr/home/user
Display all 102 possibilities? (y or n)
user/    user512/ user525/ user538/ user551/ user564/ user577/ user590/
user500/ user513/ user526/ user539/ user552/ user565/ user578/ user591/
user501/ user514/ user527/ user540/ user553/ user566/ user579/ user592/
user502/ user515/ user528/ user541/ user554/ user567/ user580/ user593/
user503/ user516/ user529/ user542/ user555/ user568/ user581/ user594/
user504/ user517/ user530/ user543/ user556/ user569/ user582/ user595/
user505/ user518/ user531/ user544/ user557/ user570/ user583/ user596/
user506/ user519/ user532/ user545/ user558/ user571/ user584/ user597/
user507/ user520/ user533/ user546/ user559/ user572/ user585/ user598/
user508/ user521/ user534/ user547/ user560/ user573/ user586/ user599/
user509/ user522/ user535/ user548/ user561/ user574/ user587/ user600/
user510/ user523/ user536/ user549/ user562/ user575/ user588/
user511/ user524/ user537/ user550/ user563/ user576/ user589/
10:38:10
#[root@fbsd3:~]#
[root@fbsd3:~]#
10:38:11
#[root@fbsd3:~]#

10:38:36
#userdel -h
[root@fbsd3:~]# exit
exit
Connection to 192.168.16.23 closed.
Usage: userdel [options] LOGIN
Options:
  -f, --force                   force removal of files, even if not owned by user
  -h, --help                    display this help message and exit
  -r, --remove                  remove home directory and mail spool
10:38:47
#date
[root@debian1:tmp]# usermod -h
Usage: usermod [options] LOGIN
Options:
  -c, --comment COMMENT         new value of the GECOS field
  -d, --home HOME_DIR           new home directory for the user account
  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -f, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -g, --gid GROUP               force use GROUP as new primary group
  -G, --groups GROUPS           new list of supplementary GROUPS
...
  -l, --login NEW_LOGIN         new value of the login name
  -L, --lock                    lock the user account
  -m, --move-home               move contents of the home directory to the new
                                location (use only with -d)
  -o, --non-unique              allow using duplicate (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new password
  -s, --shell SHELL             new login shell for the user account
  -u, --uid UID                 new UID for the user account
  -U, --unlock                  unlock the user account
Wed Jan 13 11:39:43 EET 2010
прошло 24 минуты
11:03:13
#whereis passwd
[root@debian1:tmp]# ls -l /etc/shadow
-rw-r----- 1 root shadow 13147 Jan 13 11:29 /etc/shadow
passwd: /usr/bin/passwd /etc/passwd /usr/X11R6/bin/passwd /usr/bin/X11/passwd /usr/share/man/man1/passwd.1ssl.gz /usr/share/man/man1/passwd.1.gz /usr/share/man/man5/passwd.5.gz
11:03:37
#ls -ld /tmp
[root@debian1:tmp]# ls -l /usr/bin/passwd
-rwsr-xr-x 1 root root 28480 Feb 27  2007 /usr/bin/passwd
drwxrwxrwt 14 root root 1328 Jan 13 11:30 /tmp
11:12:36
#date
[root@debian1:tmp]# date
Wed Jan 13 12:12:36 EET 2010
Wed Jan 13 12:33:57 EET 2010
/dev/ttyp0
11:19:10
#ls ~/mymotd
ls: /root/mymotd: No such file or directory
11:20:17
#cd ~

11:20:51
#pwd
/root
11:20:54
#ls
-1  1234  a  ab  abc
11:20:59
#ls -a
.   1234  abc            .bashrc  .l3rc     .mozilla  .viminfo
..  a     .bash_history  .gconf   .lesshst  .profile  .vimrc
-1  ab    .bash_profile  .gconfd  .lilalo   .ssh      .vimrc~
11:21:07
#vim ~/mymotd
--- /dev/null	2010-01-09 19:22:11.915890422 +0200
+++ /root/mymotd	2010-01-13 12:22:19.000000000 +0200
@@ -0,0 +1,2 @@
+
+Hello
11:22:19
#ls
-1  1234  a  ab  abc  mymotd
11:22:25
#vim /etc
11:22:44
#cp ~/memotd /etc/motd
cp: невозможно выполнить stat для `/root/memotd': No such file or directory
11:23:06
#vim /etc/
11:23:38
#cp ~/mymotd /etc/motd

11:23:40
#vim ~/mynologin
11:26:45
#pwd
/root
11:26:58
#cd .bashrc
[root@debian1:~]# ls -a
.   1234  abc            .bashrc  .l3rc     .mozilla  .ssh      .vimrc~
..  a     .bash_history  .gconf   .lesshst  mymotd    .viminfo
-1  ab    .bash_profile  .gconfd  .lilalo   .profile  .vimrc
bash: cd: .bashrc: Not a directory
11:27:23
#cd ..

11:27:29
#ls
bin   dev  home    lib         media  opt   root  srv  tmp  var
boot  etc  initrd  lost+found  mnt    proc  sbin  sys  usr
11:27:32
#vim /etc/
11:28:11
#find / -name mynologin

11:30:22
#find / -name
/usr/sbin/nologin
11:30:29
#vim /usr/sbin/nologin
11:30:49
#cp /usr/sbin/nologin /etc/nologin

11:31:13
#del /etc/nologin
bash: del: command not found
11:32:31
#rm

11:32:38
#su user
openpty failed
Session terminated, killing shell... ...killed.
11:33:18
#man su
11:34:08
#su user login
/bin/login: /bin/login: cannot execute binary file
11:34:14
#whoami
root
11:34:26
#sudo user
sudo: user: command not found
11:34:36
#logname
logname: регистрационное имя отсутствует
11:34:46
#passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: пароль успешно обновлён
11:40:24
#passwd user
Enter new UNIX password:
Retype new UNIX password:
passwd: пароль успешно обновлён
11:41:00
#less /etc/passwd
11:43:09
#less /etc/shadow
11:43:28
#echo $
$_                    $HISTFILE             $OPTIND
$a                    $HISTFILESIZE         $OSTYPE
$b                    $HISTSIZE             $PATH
$BASH                 $HOME                 $PIPESTATUS
$BASH_ARGC            $HOSTNAME             $PPID
$BASH_ARGV            $HOSTTYPE             $PS1
$BASH_COMMAND         $IFS                  $PS2
$BASH_LINENO          $L3_HOME              $PS4
$BASH_SOURCE          $L3_PARENT_TTY        $PWD
$BASH_SUBSHELL        $L3_SESSION_ID        $RANDOM
...
$COMP_WORDBREAKS      $LINES                $SHLVL
$DIFFNAME             $LOGNAME              $SSH_CLIENT
$DIR                  $LS_COLORS            $SSH_CONNECTION
$DIRSTACK             $LS_OPTIONS           $SSH_TTY
$editor_file          $MACHTYPE             $TERM
$editor_name          $MAIL                 $TIME
$ERR                  $MAILCHECK            $UID
$EUID                 $old_file             $USER
$GROUPS               $OLDPWD
$HISTCMD              $OPTERR
11:43:28
#echo $LOGNAME
root
11:44:33
#man su
/dev/ttyp8
11:47:25
#ls -l /proc/cpuinfo
[root@debian1:tmp]# date
Wed Jan 13 12:47:25 EET 2010
-r--r--r-- 1 root root 0 Jan 13 13:57 /proc/cpuinfo
/dev/ttyp0
11:48:44
#chfn user
Изменение информации о пользователе user
Введите новое значение или нажмите ВВОД для выбора значения по умолчанию
        Полное имя [User]: Sergey
        Номер комнаты []: 7
        Рабочий телефон []: 7
        Домашний телефон []: 7
        Другое []: 7
11:49:24
#less /etc/passwd
11:49:41
#cd ~user/files

11:53:41
#chgrp root a
[root@debian1:files]# chown root a
11:53:50
#chown user:user b

11:54:14
#mount
/dev/hda1 on / type reiserfs (rw)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
прошло 62 минуты
12:56:42
#show mount
bash: show: command not found
/dev/ttyp8
12:57:47
#vim /etc/fstab
/dev/ttyp6
13:02:29
#skreen -x
bash: skreen: command not found
/dev/ttyp8
13:07:11
#man fstab
13:07:30
#man reiserfs
13:07:30
#man reiserfs
13:07:39
#man reiserfs
13:07:53
#man mount
13:08:32
#apropos mount
free (1)             - Display amount of free and used memory in the system
mklost+found (8)     - create a lost+found directory on a mounted Linux second extended file system
mount (8)            - mount a file system
mountpoint (1)       - see if a directory is a mountpoint
sleep (1)            - delay for a specified amount of time
umount (8)           - unmount file systems
13:08:55
#apropos reiserfs
[root@debian1:tmp]# apropos reisrfs
reisrfs: nothing appropriate.
debugreiserfs (8)    - The debugging tool for the ReiserFS filesystem.
fsck.reiserfs (8)    - The checking tool for the ReiserFS filesystem.
mkfs.reiserfs (8)    - The create tool for the Linux ReiserFS filesystem.
mkreiserfs (8)       - The create tool for the Linux ReiserFS filesystem.
reiserfsck (8)       - The checking tool for the ReiserFS filesystem.
reiserfstune (8)     - The tuning tool for the ReiserFS filesystem.
resize_reiserfs (8)  - resizer tool for the ReiserFS filesystem
13:09:21
#man reiserfstune
13:09:47
#ls -l /usr/share/doc/reiserfsprogs/
[root@debian1:tmp]# ls -l /usr/share/doc/re
readline-common/ reiserfsprogs/
total 24
-rw-r--r-- 1 root root 2857 Jul 16  2003 README
-rw-r--r-- 1 root root  674 Sep  3  2004 README.Debian
-rw-r--r-- 1 root root 3641 Sep 28  2006 changelog.Debian.gz
-rw-r--r-- 1 root root 5914 Oct 13  2004 changelog.gz
-rw-r--r-- 1 root root  546 Apr 30  2004 copyright
drwxr-xr-x 2 root root  296 Dec 22  2008 html
13:10:03
#lynx /usr/share/doc/reiserfsprogs/html/fs.html
13:10:22
#lynx /usr/share/doc/reiserfsprogs/html/
13:11:04
#q
          use it through 3.5 ReiserFS tools anymore. This option
          causes conversion of old format super block to the new
          format. If not specified - old partition will be dealt with
          in a manner of 3.5.
        mount -t reiserfs -o notail /dev/sdb1 /mnt/scsi-disk-b
          Example:
        mount -t reiserfs -o conv /dev/sdb1 /mnt/scsi-disk-b
   replayonly
          improvement in some situations at the cost of losing fast
          Disable journalling. This will get you slight performance
You are already at the beginning of this document.
Are you sure you want to quit? (y)
bash: q: command not found
13:11:05
#lynx /usr/share/doc/reiserfsprogs/html/mount-options.ht
13:11:05