22 June 2008

Set Group ID permission in Linux

Posted: June 22nd, 2008 | Author: Jon | Filed under: Technology | Tags: , , , | No Comments »

How to set the default group for files and directories created under a certain directory. By default Linux uses the group of the user account used to create the file, on Debian this is usually users. The following commands should be run under the root account.

First change the group on the directory to the one you want to be used as the default:

chgrp group /path/to/directory

Then set the Group ID permission on the folder:

chmod g+s /path/to/directory

That’s all you need to do if the directory is empty, every file or sub directory created underneath this directory will inherit the group value we’ve set. If you already have sub directories in this directory and you want to set the default group value on those too then you’ll need to run the following command: 

find /path/to/directory -type d -exec chmod g+s {} \;

That’s it, job done!


7 June 2008

Set service to auto start on Red Hat EL

Posted: June 7th, 2008 | Author: Jon | Filed under: Technology | Tags: , , , | No Comments »

To set a service to automatically start at boot time on Red Hat Enterprise Linux (or CentOS) use the following command:

/sbin/chkconfig –level <level> <service> on

<level> is the runlevel, use 3 as it’s the ‘Full multi-user text mode’ runlevel on Red Hat EL/CentOS.
<server> is the name of service, i.e. the script in /etc/init.d/

Or you can use the ncurses-based /sbin/ntsysv utility.