LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 06-05-2010, 11:49 PM   #1
Andrew Dufresne
LQ Newbie
 
Registered: Sep 2009
Distribution: Fedroa 10
Posts: 27

Rep: Reputation: 16
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.

Or is there any other solution to my problem.

Thanks for your time.
Regards
 
Old 06-06-2010, 12:17 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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 {} \;
 
1 members found this post helpful.
Old 06-06-2010, 12:18 AM   #3
Mr-Bisquit
Member
 
Registered: Feb 2009
Distribution: FreeBSD, OpenBSD, NetBSD, Debian, Fedora
Posts: 770
Blog Entries: 52

Rep: Reputation: 68
Are both boxes in the same network?
 
Old 06-06-2010, 01:05 AM   #4
Andrew Dufresne
LQ Newbie
 
Registered: Sep 2009
Distribution: Fedroa 10
Posts: 27

Original Poster
Rep: Reputation: 16
Thanks catkin and Mr-Bisquit for taking interest in my problem. Really appreciated.

Quote:
Originally Posted by Mr-Bisquit View Post
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 View Post
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 View Post
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
Code:
chown Andrew {} \;
Kindly guide me.
 
Old 06-06-2010, 02:20 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by Andrew Dufresne View Post
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 View Post
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.
Code:
find / -user <Andrew's old numeric ID> -exec /bin/ls -ld {} \;
 
1 members found this post helpful.
Old 06-07-2010, 03:25 AM   #6
Andrew Dufresne
LQ Newbie
 
Registered: Sep 2009
Distribution: Fedroa 10
Posts: 27

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by catkin View Post
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 View Post
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.
Code:
find / -user <Andrew's old numeric ID> -exec /bin/ls -ld {} \;
Thanks catkin, I got your point this time.

Thanks for solving my problem.
 
  


Reply

Tags
chown



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
root account or user account arodlinux SUSE / openSUSE 3 12-23-2008 08:59 PM
Prevent user account from logging in but allow su to account DejaCpp Linux - General 4 07-26-2006 11:44 AM
system account or user account??? yenonn Linux - Newbie 6 05-10-2006 07:49 PM
is it legitimate and allowed and can be done to make another user account set uid and gid to null 0 to make another root account with different name and possibly not damage the debian system creating and using that new account BenJoBoy Linux - Newbie 12 01-29-2006 10:02 AM
win2000 boxes cannot map but winnt boxes can - same user! starbeetlechick Linux - Networking 0 07-24-2003 07:24 AM

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

All times are GMT -5. The time now is 09:46 PM.

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