LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 10-21-2002, 06:23 PM   #1
nxny
Member
 
Registered: May 2002
Location: AK - The last frontier.
Distribution: Red Hat 8.0, Slackware 8.1, Knoppix 3.7, Lunar 1.3, Sorcerer
Posts: 771

Rep: Reputation: 30
Switch groups in mid-session


Guys:
my regular login is a member of 2 groups. My default group is 'users' whereas the other is 'apache' which I created a while ago. All files under my webserver doc root have been chgrp-ed to apache and chown-ed to root. Although it doesnt matter, root also happens to be a member of apache. The httpd daemon runs as 'nobody' and accesses the doc root using the 'world' permissions r-x. All is well and good.

As you can see from below, the only logins who have write access to this folder are members of the group 'apache' apart from root. When I create a new file ( touch test.file ) it goes under 'users' instead of 'apache' as I had expected. This defeats the purpose for which the group 'apache' was created in the first place. Is there a way that I can switch over to apache (and thereby assume a web-admin personality ) when I am modifying the doc-root contents? I dont mind doing this via a command ( since I dont want to change my default group ) . The idea is to avoid having to chown, chmod etc for another non-root-apache-member to modify the files I have messed around with.

Help appreciated.

$ls -al /var/www/html/
-rwxrwxr-x 1 root apache 14k Sep 29 11:19 cimap.html*
drwxrwxr-x 2 root apache 4.0k Oct 21 02:31 css/
drwxrwxr-x 5 root apache 4.0k Oct 21 14:53 dvb/
drwxrwxr-x 2 root apache 4.0k Jul 21 18:03 errors/
drwxrwxr-x 2 root apache 4.0k Oct 21 10:30 images/
-rw-rw-r-- 1 root apache 1.1k Oct 21 02:23 index.php
drwxrwxr-x 3 root apache 4.0k Sep 30 01:06 manual/
drwxrwxr-x 2 root apache 4.0k Oct 21 01:46 php/
drwxrwxr-x 2 root apache 4.0k Oct 21 14:53 ramu/
-rw-rw-r-- 1 root apache 1.7k Sep 26 00:09 sysInfo.html
-rw-rw-r-- 1 root apache 346 Sep 29 09:08 thud2.html
-rw-rw-r-- 1 root apache 1.9k Sep 28 22:36 thud.html
drwxrwxr-x 2 root apache 4.0k Sep 30 01:09 wordtrans/
 
Old 10-22-2002, 10:42 AM   #2
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Try using "chmod g+s" on the docroot and any other subdirectories. This should force new files to pickup the group id of the parent directory.
 
Old 10-22-2002, 11:17 AM   #3
nxny
Member
 
Registered: May 2002
Location: AK - The last frontier.
Distribution: Red Hat 8.0, Slackware 8.1, Knoppix 3.7, Lunar 1.3, Sorcerer
Posts: 771

Original Poster
Rep: Reputation: 30
Thanks stickman. That worked. Just out of curiosity.. is there a way that I can switch gid's in mid session?
 
Old 10-23-2002, 12:47 AM   #4
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 46
newgrp
 
Old 10-23-2002, 11:10 AM   #5
nxny
Member
 
Registered: May 2002
Location: AK - The last frontier.
Distribution: Red Hat 8.0, Slackware 8.1, Knoppix 3.7, Lunar 1.3, Sorcerer
Posts: 771

Original Poster
Rep: Reputation: 30
Thanks moses. Just what I was looking for.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
lock session / switch user wooot Suse/Novell 4 06-13-2005 01:54 PM
Lose permissions mid-session johngcarlsson Linux - Newbie 18 08-02-2004 07:23 PM
msec in MDK 10 makes me lose permissions mid-session johngcarlsson Mandriva 2 07-19-2004 07:00 PM
x server refuses connections in mid-session mark9121 Linux - General 3 09-21-2003 09:30 PM
switch user for the whole KDE session, not just the Konsole glock19 Linux - General 2 12-12-2001 02:31 PM


All times are GMT -5. The time now is 10:56 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration