Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Edit the fourth field of the /etc/passwd file. This is the GID entry for the user. Change it to the GID of the new default group. Your can look up the GID number of the group from the /etc/group file.
For example (as root),
1) add a user edward. useradd edward passwd edward[enter]
edspassward[/b][enter]
2) add a group edgroup. groupadd edgroup
3) examine record for user edward grep edward /etc/passwd edward:x:502:502::/home/edward:/bin/bash
4) examine record for group edgroup grep edgroup /etc/group edgroup:x:503
5) edit gid field for user edward in /etc/passwd. (i.e. change second 502 to 503) sed '/^edward:/s/:502:502:/:502:503:/' /etc/passwd >/etc/passwd.tmp mv -f /etc/passwd.tmp /etc/passwd
You could use an editor like vi to edit the /etc/passwd file if you prefer.
Now log in as user 'edward' and touch a testfile. touch testfile ls -l testfile
Notice that the group field of the listing says edgroup.
---
ps
The solution given above is better. While I was testing my answer on another computer he submitted his answer. (how do I delete a message I wrote? I tried 'Reset Message' but it didn't work)
Thanks alot guys. I was hoping there was a way to maintain a different default group in /etc/passwd from the default group used for wrinting fines. Guess that that s not possible.
You'll need to repeat the last response. I didn't understand what you mean by 'wringing'.
You can create a new group and make certain users members of that group. You can also make this group their default group with the 'usermod -g groupname' mentioned above. That should provide exactly what you were asking about in your original message.
However, what is usually done is leaving the default group alone, but making users members of a certain group. This is the linux version of ACL lists.
Thanks alot guys. I was hoping there was a way to maintain a different default group in /etc/passwd from the default group used for wrinting fines. Guess that that s not possible.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.