LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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-01-2011, 02:32 PM   #1
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,397

Rep: Reputation: 101Reputation: 101
UID and different distros


I am posting this here because it is not really distro specific and I think it is somewhat basic although the answer may not be I am in the process of "trying" a new distro - CentOS 5.6 - on my Ubuntu 10.04 PC.

The PC when running Ubuntu has two hard drives installed. The OS is on /dev/sda1, /home is on /dev/sda2 and most of my data files are on /dev/sda3 which is mounted as /data. Swap is on /dev/sda4. The second hard drive has one partition /dev/sdb1 mounted as /quitelarge (it is a 1 TB drive! so it was large when I purchased it). I have a nightly batch program which archives important data files from /data to /quitelarge/mirror.

To "try" CentOS I physically removed the /dev/hda drive and substituted another drive. I have CentOS installed on the new /dev/sda which is partitioned the same way as I described above for the Ubuntu disk. I have the nVidia driver installed and mostly tamed. I have installed a few packages which I like to use such as Gnome-commander, VLC, VMWare Player etc. So now I decided to pull some of my files from last night's backup to the new /data partition. I am having some issues reading and/or writing from/to /quitelarge. I think this is a clue
Quote:
[ken@taylor12 quitelarge]$ ls -l
total 2592788
-rw-r--r-- 1 1000 1000 10201597 Jun 10 2010 The Definitive Guide To SQLite (2006).pdf
-rwxrw-r-- 1 1000 1000 471552 Aug 26 2005 TIW_OTHER_TELE.xls
-rwxrw-r-- 1 1000 1000 5937152 Aug 26 2005 TIW_WORKER.xls
drwxr-xr-x 5 1000 1000 12288 Jun 1 06:07 tmp
The files and directories on /quitelarge are owned by UID 1000 which on Ubuntu was my user, ken. On CentOS ken has a UID of 500. These UIDs are assigned during the install/initial user creation and are distro specific and I had not thought about them until now.

So the question is... how can I access /quitelarge from both Ubuntu and CentOS? I do not want to make bulk changes to ownership and permissions in CentOS lest I face the same issue when I go back to Ubuntu.

For the moment I will copy selected files as root from /quitelarge to /data, change the permissions on them and not worry about ever using those files in Ubuntu again. Still, there should be a better way I would hope.

TIA,

Ken
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 06-01-2011, 02:57 PM   #2
segmentation_fault
Member
 
Registered: Sep 2008
Location: Ioannina, Greece
Distribution: Gentoo
Posts: 332

Rep: Reputation: 55
You can modify one of your user's uid. See "man usermod".
 
2 members found this post helpful.
Old 06-01-2011, 03:10 PM   #3
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Quote:
Originally Posted by segmentation_fault View Post
You can modify one of your user's uid. See "man usermod".
UID and GID.

This is the sort of thing that I would do by directly editing /etc/passwrd and /etc/group.
 
1 members found this post helpful.
Old 06-01-2011, 03:41 PM   #4
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,397

Original Poster
Rep: Reputation: 101Reputation: 101
OK so if I change "ken" in CentOS to UID 1000 then that account would own the files on /quitelarge if I understand. I will give that a try. At the moment I am back in a knock down drag out fight with nVidia. But I can play my mp3s and videos on CentOS once I get X running. Long live VLC! Thanks, Ken
 
Old 06-01-2011, 11:42 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
You could just put both in the same group (as secondary group if you want). No need to mess with uid.
Consider them as actually being different people ..
 
1 members found this post helpful.
Old 06-02-2011, 10:47 AM   #6
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,397

Original Poster
Rep: Reputation: 101Reputation: 101
Thanks chrism01, that sounds like a great plan. I added a user "moe" with UID 1000. I added my account "ken" to group moe:1000. I can now access files on /quitelarge. However, the directory and its subdirectories were created in Ubuntu with the owner set to Ubuntu ken:1000. So this only got me part way.

Next I deleted user moe and edited /etc/passwd and /etc/groups to make ken UID 1000 and group 1000. This of course hosed permissions to /home/ken and I could not startx after login.

I deleted user ken and re-created user ken with UID 1000. Again login was hosed. Turns out the files under /tmp/gconf-ken were not deleted when the account and its home were deleted. I deleted /etc/gonf-ken and now can login with ken:1000 and all is well. (I did not have anything of value in /home/ken so I was not concerned about zapping it).

I am going to restore the OS from a snapshot and try using usermod to make the changes. I have experimented with the command after reading the man page and have seen that it changes only UID but leaves the user in the original group. This may well fix the issues I came across with my other attempts.

Bottom line - when I install CentOS for real I will create a dummy user as the default 500 and manually create ken:1000 later.

Thanks for all the great advice!

Ken
 
Old 06-02-2011, 11:49 AM   #7
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,397

Original Poster
Rep: Reputation: 101Reputation: 101
p.s.

I restored the OS partition, logged in as root and used usermod to change ken's UID
Quote:
[root@taylor12 data]# usermod -u 1000 ken
then I logged out as root. (I have the machine set to runlevel 3 as I still have a little concern about the nVidia driver.) However, account ken could not startx - same gconf-ken issue. I deleted the offending directory and now can login and run X as ken. I have the desired permissions to all directories and files on /quitelarge.

Thanks again,

Ken
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Real uid and effective uid palisetty_suman Linux - Newbie 2 02-15-2009 01:59 PM
how can I see the default UID values on different distros? elrom Programming 1 11-13-2007 10:15 AM
Changing the UID of a Physical Volume to a specific UID jambraun Linux - Newbie 2 02-09-2006 03:34 PM
FREEBSD5.3 platform: PHP setcookie() successful, but $uid = $_COOKIE['uid']; fail tclwp Programming 1 03-30-2005 09:05 PM


All times are GMT -5. The time now is 03:44 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration