LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-27-2007, 05:24 PM   #1
gentooox
LQ Newbie
 
Registered: Oct 2007
Posts: 3

Rep: Reputation: Disabled
Question Changing the 'default' group when creating files


When a user is a member of more than 1 group, which setting determines what group is used when creating files and directories?
Ex.: user A is member of the groups 'cats' and 'dogs'. When he creates a file, user A is the owner, and per default, 'cats' is used as the owning group. 'cats' is always used. How can I change this to always being 'dogs' instead?
Thanks for your time

Last edited by gentooox; 10-27-2007 at 05:40 PM.
 
Old 10-27-2007, 05:48 PM   #2
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Try
Code:
usermod -g dogs <username>
 
Old 10-27-2007, 05:51 PM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
It is the main (primary) group for the user. You can temporarily switch the primary group to one of the auxiliary groups using the sg command in terminal, in much the same way that you can switch to another user using su. For example:
Code:
% groups
matthew adm dialout cdrom floppy audio dip video plugdev scanner fuse lpadmin admin netdev powerdev
% touch file1
% sg adm
% touch file2
% exit
% touch file3
% ls -l file?
-rw-r--r-- 1 matthew matthew 0 2007-10-27 22:49 file1
-rw-r--r-- 1 matthew adm     0 2007-10-27 22:50 file2
-rw-r--r-- 1 matthew matthew 0 2007-10-27 22:50 file3
 
Old 10-27-2007, 05:56 PM   #4
gentooox
LQ Newbie
 
Registered: Oct 2007
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thumbs up Solved

Quote:
Originally Posted by saikee View Post
Try
Code:
usermod -g dogs <username>
That did it, thanks a lot!
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the default icon for Files with some extention me4linux Linux - Software 2 08-14-2007 03:17 PM
creating a new group for CDRW xucaen Debian 2 09-26-2005 12:24 PM
changing ownership and group of multiple files.. utanja Debian 3 02-21-2005 07:10 PM
Changing a user's default group dogn00dles Linux - Security 4 07-09-2003 04:59 PM
Creating A Group MikeeX Slackware 1 04-25-2002 09:00 PM


All times are GMT -5. The time now is 05:38 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration