2008ǯ02

ƥ:

If you would like to make an user who could not log into the system like just mail account user, use nologin instead of bash. nologin is a special command that politely refuse a login.

# grep nologin /etc/shells
/sbin/nologin

Use -s option to define the shell.

# useradd -s /sbin/nologin tomato
# su - tomato
This account is currently not available.

If you would like to change the shell of existing user, use usermod command.

# usermod -s /sbin/nologin lettuce
# su - lettuce
This account is currently not available.

ꥫǸĤ(JFK )

ƥ:

TrashܿͤˤȤäƥߤΤƤȤʬ̤ȤȤϡ̤ʤȤǤϤޤ󡣤Ȥꥫ(U.S.A.)ξʤȤ˥塼衼ͥХ󥸥륹դǤ̤ˤʳǰƳƤޤ

եȥաɤȤǥߤΤƤ褦ˤ⡢ϰĤΤߡۤȤɤܿͤǤСӤƤΡʤɤǺ˰㤤ޤ󡣤䡢Ǥ衣ͤùߤޤ礦

Τ߻ĤҡȤ⡼Ǥ⤹ä¿ưߤʤΡܤȰ߻ĤΤƤȤ¿ɡ󥢥ꥫˤϤʤΤϤޤ衪餽ΤޤޥȢءƲ˷꤬ܤġ䤿˾ΤϤΤ͡

Ȥ˵Ե˾뤿 JFK (Fͥǥݶ)عԤäӤäꡣʹΤƤ褦Ȥ3ĤΥȢ¤Ǥġ

֥åΤθͤꥫĶͥʤޤȤȤʤΤʡ

ƥ:

This is traditional way of making user. At first, you need group (vegetable). Then you make a user (cabbage) with initial group vegetable. This time user cabbage has umask 022.

# groupadd vegetable
# useradd -g vegetable cabbage
# id cabbage
uid=509(cabbage) gid=505(vegetable) groups=505(vegetable)
# su - cabbage
$ umask
0022
$ touch hello
$ ls -l hello
-rw-r--r--  1 cabbage vegetable 0 Feb 25 09:01 hello

You could make a user (lettuce) without initial group. This time user automatically belongs to an initial group that has users name. The user has umask 002.

# useradd lettuce
# id lettuce
uid=510(lettuce) gid=510(lettuce) groups=510(lettuce)
# su - lettuce
$ umask
0002
$ touch hello
$ ls -l hello
-rw-rw-r--  1 lettuce lettuce 0 Feb 25 09:03 hello

ƥ:

If you made users, john and paul. You could make passwords automatically with the following commands. If there is no uuencode command, install it with 'yum install sharutils.'

# for user in john: paul:
> do
> echo -n $user
> head -c 6 /dev/random | uuencode -m - | sed -n '2p'
> done > /tmp/password
# cat /tmp/password
john:2S+dJ64l
paul:FwWcC2F0

chpasswd command assign passwords from the file.

# chpasswd < /tmp/password

ƥ:

Root user only could mount cd media.

$ mount /media/cdrom
mount: only root can mount /dev/hdc on /media/cdrom

If you add "user" option in a file /etc/fstab, user could mount it.

# vi /etc/fstab
/dev/hdb    /media/cdrom    auto    pamconsole,exec,noauto,managed,user 0 0

$ mount /media/cdrom
$ ls /media/cdrom
isolinux  squashfs.img  sysroot

ƥ:

You could use ISO image file without CD-R media. Use mount command with loop option.

# mount -o loop -t iso9660 ./Fedora-8-Live-i686.iso /media/cdrom
# ls /media/cdrom
GPL  isolinux  LiveOS  README

When you finish, just unmount it.

# umount /media/cdrom

ƥ:

륹ץȤ¹ԤȥȥǤϤʤ̤ΥˤäƼ¹ԤޤǤϤɤΤ褦˳ǧǤǤ礦

ޤ߻ȤäƤ륷PIDɽˤ"$$"Ȥޤ

$ ps
  PID TTY          TIME CMD
24586 pts/0    00:00:00 bash
$ echo $$
24586

륹ץȤdzǧ뤿˲Υץޤ1ܤɸॷ(sh)ꤷƤޤ¹Ԥ sh ¹ԤƤ뤳Ȥʬޤ

$ cat show_me_shell.sh
#!/bin/sh
ps ax | grep `echo $$`
$ ./show_me_shell.sh
24647 pts/0    S+     0:00 /bin/sh ./show_me_shell.sh

1ܤλ csh ѹȳΤˡcsh Ǽ¹Ԥ뤳Ȥʬޤ

$ cat show_me_shell.sh
#!/bin/csh
ps ax | grep `echo $$`
$ ./show_me_shell.sh
24655 pts/0    R+     0:00 /bin/csh ./show_me_shell.sh

1ܤǥꤷʤ sh Ǽ¹Ԥޤ¹Ǥ bash ѤƤޤϾʤȤ Red Hat ϤΥǥȥӥ塼Ǥ sh bash ؤΥܥå󥯤ˤʤäƤ뤫Ǥ

$ cat show_me_shell.sh
ps ax | grep `echo $$`
$ ./show_me_shell.sh
24672 pts/0    R+     0:00 -bash

$ ls -l /bin/sh
lrwxrwxrwx  1 root root 4 Dec 22 11:31 /bin/sh -> bash

ƥ:

If you do not want a bell(beep) sound when using tab key. Write "set bell-style none" to a file /etc/inputrc.

# vi /etc/inputrc
# do not bell on tab-completion
set bell-style none

ƥ:

If you are root user, you could send message to all users who logged in with wall command.

root user

# wall "We will have a meeting tomorrow noon."

Broadcast message from root (pts/0) (Wed Feb 6 19:06:05 2008):

We will have a meeting tomorrow noon.

user

$
Broadcast message from root (pts/0) (Wed Feb 6 19:06:05 2008):

We will have a meeting tomorrow noon.

ƥ:

Is enter key too far? So, use ctrl-m instead. It works same as enter key. Also, ctrl-h works same as Backspace key.

ΥڡΥȥåץ

Ф