Tuesday, August 19, 2008

Setting the inital file permissions using umask

umask command is used to set the default permission modes for newly created files in the current shell and its child processes.

umasks are calculated as the AND of the unary complement of the argument (NOT) and the full access mode.

The full access mode is 666 in the case of files, and 777 in the case of directories

A common umask value is 022 (masking out the write permission for the group and others), which ensures that new files are only writable for the owner (i.e. the user who created them). Another common value is 002, which leaves the write permission for the file's group enabled. This can be used for files in shared workspaces, where several users work with the same files.

Example usage of setting umask

Assuming the umask has the value 163, any new file will be created with the permissions 604 and any new directory will have permissions 614 because:

666 AND NOT(174) = 604
666=110 110 110
163 = 001 110 011
NOT(001 110 011) = (110 001 100)
(110 110 110) AND (110 001 100) = (110 000 100)
777 NOT (163) = 604
while

777 AND NOT(163) = 614

777 = 111 111 111
163 = 001 110 011
NOT(001 110 011) = (110 001 100)
(111 111 111) AND (110 001 100) = (110 001 100)
777 NOT (163) = 614

Monday, August 11, 2008

Attaching serial console on a Linux box

Step # 1: Setup Serial redirection

By default, grub output does not appear on the remote console; it only appears on the local terminal. However, you can configure your grub.conf file to redirect all grub output to the remote console. Redirection will display the grub output on the remote console, but not on the local terminal. To redirect grub output, make the following changes to your /etc/grub.conf file:


# vi /boot/grub/grub.conf
Append the following lines in the file

serial --unit=1 --speed=19200 --word=8 --parity=no --stop=1
terminal --timeout=8 console serial

* The first line tells GRUB to use the first serial port at a baud rate of 19200
* The second line gives the user 9 seconds to decide where GRUB should output it's information.
* Please adjust port number and speed as per your setup.

Next make sure splashimage options is disabled as graphics can't be displayed across the serial port. Remove splashimage line or just comment it out by prefixing # symbol:
#splashimage=(hd0,0)/grub/splash.xpm.gz

Also please comment out the hiddenmenu option ( We had some issues at times when tried using this, so to be on safer side,disable it )


Step # 2: Enabling serial output from the Linux kernel


Find the kernel line (grub config file) which corresponds to your currently running kernel. Add the following at the end of that line - console=tty0 console=ttyS0,9600n8:

title Red Hat Enterprise Linux ES (2.6.9-42.0.10.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.0.10.ELsmp ro root=LABEL=/ console=tty0 console=ttyS1,19200n8
initrd /initrd-2.6.9-42.0.10.ELsmp.img


On Red Hat EL nodes, please make the following changes

* Set SAFE=YES in /etc/sysconfig/kudzu

Remote installation of OpenSuse-11 on an IBM PPC

1. Setup the DHCP/BOOTP/PXE/TFTP server to boot from network
3. Boot from network
4. The yaboot prompt will appear. Please enter
install vnc=1 ssh=1
to start the installation on vnc and to enable ssh connections.
5. You'll be asked to enter the vnc and ssh password. Please enter a password of your choice here.
Enter your VNC password>
Enter your temporary SSH password>
6. You'll be asked to choose the network interface you want to use.
Choose the network device.
1) eth1 : Broadcom NetXtreme BCM5704S Gigabit Ethern
2) eth0 : Broadcom NetXtreme BCM5704S Gigabit Ethern
Automatic configuration via DHCP?
1) Yes
2) No

7 Opensuse now starts the installer, Connect to the VNC server with a viewer of your choice
vncviewer :1