[SOLVED] How to have same user account on two different boxes?
Linux - NewbieThis 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
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.
How to have same user account on two different boxes?
cHi,
I have two Fedora 10 boxes. Both have a user account, Andrew. I use this account all the time.
Now when I put my USB drive (ext3-filesystem) in box I, create a file in it. It works.
But when I attach it to box II and try to access the files, it gives me error - Permission denied.
I have to use
Quote:
sudo chown -R Andrew
Only then I am able to access the files in it.
When I attach my drive to box I again, it also gives me error - Permission denied. So in both boxes, I have to use
Quote:
sudo chown -R Andrew
first. Otherwise I get Permission denied message.
This means Andrew on both systems is different. How can I make Andrew account on both systems same? So that I can access files on my usb drive without running chown all the time.
The numeric ID for Andrew must be the same in /etc/passwd on both systems. If you change it on one of the systems then Andrew will no longer be the owner of files it/you used to own. These files should (TM) all be under /home/Andrew but may not be. All the files under /home/Andrew may not be owned by Andrew. For these two reasons a simple sudo chown -R Andrew /home/Andrew is not a safe way to fix the ownership change. Better (untested):
Code:
find / -user <Andrew's old numeric ID> -exec chown Andrew {} \;
Thanks catkin and Mr-Bisquit for taking interest in my problem. Really appreciated.
Quote:
Originally Posted by Mr-Bisquit
Are both boxes in the same network?
No they aren't. Right now, I have access to one box only.
Quote:
Originally Posted by catkin
The numeric ID for Andrew must be the same in /etc/passwd on both systems. If you change it on one of the systems then Andrew will no longer be the owner of files it/you used to own. These files should (TM) all be under /home/Andrew but may not be. All the files under /home/Andrew may not be owned by Andrew.
Great tip! I will surely keep it in my mind.
So if I manually change numeric ID on one of the box, is it safe. I found that on my current box, numeric ID of Andrew is 500. So on box II, if I edit /etc/passswd using vim, is it safe?
Quote:
Originally Posted by catkin
For these two reasons a simple sudo chown -R Andrew /home/Andrew is not a safe way to fix the ownership change. Better (untested):
Code:
find / -user <Andrew's old numeric ID> -exec chown Andrew {} \;
Dear, this part has confused.
Code:
find / -user <Andrew's old numeric ID> -exec chown Andrew {} \;
will work when find finds a file whose owner is Andrew, right? Only then exec part of the command will work. That's what I understand. Correct me if I am wrong.
So if the owner is already Andrew, what's the use of
So if I manually change numeric ID on one of the box, is it safe. I found that on my current box, numeric ID of Andrew is 500. So on box II, if I edit /etc/passswd using vim, is it safe?
Probably, but safer to use usermod with the --uid option.
Quote:
Originally Posted by Andrew Dufresne
So if the owner is already Andrew, what's the use of
Code:
chown Andrew {} \;
The user (= UID, the numeric ID) would no longer be Andrew because Andrew would have a new UID. You can illustrate this by doing ls -al /home/Andrew which should show the owner as Andrew's old UID. You have to replace <Andrew's old numeric ID> with, er, Andrew's old numeric ID and that is how find will find the correct files. For reassurance you could run this command first to make sure find is finding the files you want to change.
Probably, but safer to use usermod with the --uid option.
Well I tried usermod with uid today on my second box and the problem is solved. Now I can access my flash drive without having to run chown all the time.
There were few hiccups though. I was not able to run few commands. It kept giving me error about .gvfs. Then screen wasn't working too. Each time I opened a terminal it gave me an error: id 501 not found. My bash prompt will appear as "i do not know my name@localhost$"
I logged out from the system and then logged in again. Problem solved
Quote:
Originally Posted by catkin
The user (= UID, the numeric ID) would no longer be Andrew because Andrew would have a new UID. You can illustrate this by doing ls -al /home/Andrew which should show the owner as Andrew's old UID. You have to replace <Andrew's old numeric ID> with, er, Andrew's old numeric ID and that is how find will find the correct files. For reassurance you could run this command first to make sure find is finding the files you want to change.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.