-   Linux - Newbie (
-   -   Problem assigning new user to my group (

Odyssey1942 08-08-2006 05:25 PM

Problem assigning new user to my group
I'm probably missing something obvious. I have added a user (call it user 2) and want this user to be part of my group so we can share common interest work files. I have:


so it appears to me that user2 is not in my group. No?

When user2 signs in, they cannot see the folder on my desktop that we both need to be able to access and I want it to show on the desktop of user2. Try as I might I cannot "re-assign" user2 to my group. What should I do? TIA

I'm running Ubuntu 5.04

acid_kewpie 08-08-2006 05:43 PM

A user will have their own home directory, but this has nothing to do with what groups they are a member of. If you run "id -a" as that user and you'll see all groups that they are a member.

Odyssey1942 08-12-2006 06:20 PM

Apologies for my limited abilities here, but I had tried to figure out how to do as Chris suggests, but was not able, so just thought that I would wait for the next reboot, then sign on as that user. But have had so many things going on this computer that I have not wanted to reboot.

Since I have admin privileges, and was the one who set up this user, is there not a way that I can see the group of this user without having to log in as that user? Even when I know what group they belong to, I still will not know how to move them to my group (which is the original purpose of the thread.) Any guidance on how to accomplish this will be greatly appreciated

btmiller 08-12-2006 06:48 PM

You can run "id -a <username>" as any user to see <username>'s groups. To add them to your group, open up /etc/group in your favorite editor (running as root). Find the line with your group name in it -- it will look something likw:


change it to:


where otheruser is the user you want to add to the group. The change will take place rthe next time otheruser logs in.

doronunu 08-13-2006 12:27 PM

if you put him in the same group as your main group it will be a security warning couz he will have some privileges on all of your file because all the file you make/download and so on, r getting by default your main group.
so what u need to do is to use one shared group that is not ur main lets call it share.
then u need to change your desktop group to share. and finally u need to change the privileges to SGID. what will append is that all the file youll write in this directory will get the share group as group and not your main group so he will only have privileges to this files and for your others files hell get the privileges for "others".

this is how u should do it :

first make the group

groupadd share
then add the user in the /etc/group as the post before show u.
then change ur directory group :

chgrp share ~odyssey/Desktop
now put the SGID privillage :

chmod g+s ~odyssey/Desktop

Odyssey1942 08-13-2006 12:40 PM

Great. When I get to the office, will try these and post back the results. Many thanks.

Odyssey1942 08-13-2006 05:58 PM

first tried id -a officeuse (where officeuse is the real user2)
and got:

uid=1001(officeuse) gid=1000(odyssey) groups=1000(odyssey),21(fax),24(cdrom),29(audio),30(dip),44(video),46

So I read this that I am group id 1000 and officeuse is group id 1001 (and therefore not a part of my group), so

next is vi /etc/group

where it appears to me that the target line is


above and it should be modified to read:


Do I have this right?

also very important. I did not know how to use vi and have futzed around and made many changes which I did not mean to make and now need to exit without saving any changes and then start over. I type in :q! but I get an error code and it doesn't quit. How do I accomplish this please?

Odyssey1942 08-13-2006 06:22 PM

Have managed to undo the changes that I had made and have compared to the original text of the file which I had copied and pasted into a text editor immediately upon opening it.

Am now trying to close the file using :x but am being requested to enter an encryption key, when all I want to do is close the file. Help!

Odyssey1942 08-13-2006 06:29 PM

If I just click on the " X " at the top right hand corner and close the editor, will it close without saving any changes or will it record the changes. How do I get out of this?

doronunu 08-14-2006 06:57 AM

press esc 2 times.
then :wq.
this write the changes and quit.

out from vi without saving

by the way as is aid before do anew group. dont put him on yours or it will be a security risk.

Odyssey1942 08-14-2006 01:15 PM

doronunu, thanks for this and will try to rescue myself as soon as I can get to that computer.

My plan is to figure out how to get the group thing right, then explore your suggestions. This is the "general" computer in our office and I do not have any files or docs that our General Manager cannot have access to. I have my own computer in my office (and this is the one that ideally I should have installed Ubuntu to, but the other one had crashed and needed reinstalling. I just thought, "What the hell?" and plunged right in.)

Slowly, slowly, linux is penetrating my thick skull, thanks to the invaluable help of all of those like you who hold our hand through this process. You are all much appreciated.

Odyssey1942 08-14-2006 01:46 PM

tried the

press esc 2 times, then :wq.

First it gave me a "read-only error, add " ! " to override"

so I added the ! and got the error message:

" /etc/group " E212 Can't open file for writing"

Have I done something wrong?

Odyssey1942 08-14-2006 02:55 PM

Decided to try to sign in as root and rerun the vi and it worked. I think! At least it saved the file with the change.

Now I want to log in as user2 and see if I can see the files. If I just change user to user2, havalook, and return to myself (i.e., Odyssey), will all my program states and open folders: email client, browsers, etc still be as they were when I changed to user2?

doronunu 08-14-2006 05:00 PM

yes every thing will be in is rihgt place.

what vi ment is that u have only read premissins on the file.
you need to change him as root.

and for the error he ment that u dont have write premissions for the file so u cant do :wq (write&quit).
so u need to press :q! (quit without saving).

Odyssey1942 08-17-2006 03:17 PM

It took me a little time to feel like I understood the previous post. However if I do, it makes me wonder. Since I created the files (albeit on a Windows computer) and after transferring it to Ubuntu, had modified the permissions (which already included me as read, write, and execute) to include my group for read, write, and execute, why did the shell think I was not authorized?

All times are GMT -5. The time now is 10:16 PM.