LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 04: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 04:40 PM.
 
Old 10-27-2007, 04: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: 113Reputation: 113
Try
Code:
usermod -g dogs <username>
 
Old 10-27-2007, 04:51 PM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
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, 04: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



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 02:17 PM
creating a new group for CDRW xucaen Debian 2 09-26-2005 11:24 AM
changing ownership and group of multiple files.. utanja Debian 3 02-21-2005 06:10 PM
Changing a user's default group dogn00dles Linux - Security 4 07-09-2003 03:59 PM
Creating A Group MikeeX Slackware 1 04-25-2002 08:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:49 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
Open Source Consulting | Domain Registration