LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-14-2016, 10:41 PM   #1
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163
Error Opening File Permission Denied on all 3 drives


After reading this I'm thinking that I need to use the chmod command because I can not access the files from LM when I have Arch Linux up and running and vice versa.

http://linuxcommand.org/lc3_lts0090.php

BTW this is not my machine so I have to be careful.

Arch is installed to the 500 GB WD drive, LM KDE is installed to the 128 SSD, & LM Cinnamon to the 120 Hitachi HDD.

Code:
Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders, total 250069680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000688b0

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   246069247   123033600   83  Linux
/dev/sda2       246069248   250068991     1999872   82  Linux swap / Solaris

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004454a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048   972771327   486384640   83  Linux
/dev/sdb2       972771328   976771071     1999872   82  Linux swap / Solaris

Disk /dev/sdc: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x912f676e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048   230436863   115217408   83  Linux
/dev/sdc2       230436864   234440703     2001920   82  Linux swap / Solaris

There are too many files to chmod a+x one at a time.

Code:
-rw-r--r--  1 1000 1000   86927645 Oct 14  2014 'CC Applications For Fighting In Tai Chi Pushing Hands Tui Shou In Details 1.mp4'
-rw-r--r--  1 1000 1000  120896934 Oct 14  2014 'CC Applications For Fighting In Tai Chi Pushing Hands Tui Shou In Details 2.mp4'
-rw-r--r--  1 1000 1000  154404213 Oct 14  2014 'CC Applications For Fighting In Tai Chi Pushing Pands Tui Shou In Details 3.mp4'
-rw-r--r--  1 1000 1000  104588632 Oct 14  2014 'CC Applications For Fighting In Tai Chi Pushing Pands Tui Shou In Details 4.mp4'
-rw-------  1 1000 1000    3777505 May  4  2014 'CC Bladder 57 Info.mp4'
-rw-r--r--  1 1000 1000  163839032 Apr 18  2015 'CCD Feng Zheng Bao Bagua.mp4'
-rw-r--r--  1 1000 1000  383246496 Apr 18  2015 'CCD Liang Style BaGua Basic Exercises.mp4'
-rw-r--r--  1 1000 1000  254819595 Apr 18  2015 'CCD Liang Style BaGua Old Eight Mother Palms.mp4'
-::-Before I installed Apricity (based on Arch) I was able to mnt any HDD or SSD and cp and paste to any directory I wanted to.
-::-I'm not sure what changed that.-::-

I know how to chmod on one file at a time but that would take all day and there are many files that have to be copied.

How would I chmod on the whole directory?

Thanks in advance-
Ztcoracat
 
Old 03-14-2016, 11:09 PM   #2
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 6,317

Rep: Reputation: Disabled
The UID and GID are 1000, you have no matching user in your running Linux, thus you cannot access those files. When running multiple Linux versions or accessing files over NFS I suggest you use same UID for your user in all boxes.
 
Old 03-15-2016, 06:22 AM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,901
Blog Entries: 13

Rep: Reputation: 4029Reputation: 4029Reputation: 4029Reputation: 4029Reputation: 4029Reputation: 4029Reputation: 4029Reputation: 4029Reputation: 4029Reputation: 4029Reputation: 4029
Quote:
Originally Posted by Ztcoracat View Post
There are too many files to chmod a+x one at a time.
Code:
$ sudo chown -R <username> *
$ sudo chgrp -R <grpname> *
Are the first things I'd use, however for the chmod, you can also use the -R switch to cause it to be recursive.

Per Emerson's point, and why I posted the chmod/chown command examples, I had a similar situation with a LIVE boot USB that had the default user and mounted other flash drives were mounted as root thus making the mounted flash drives read-only to that default user. My solution was to do the first command and change all ownership and grouping of the entire mounted drive. That's a one-time thing unless I changed my LIVE boot system to something else, I usually don't.

Last edited by rtmistler; 03-15-2016 at 06:23 AM.
 
Old 03-15-2016, 03:15 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137
Quote:
Originally Posted by Emerson View Post
The UID and GID are 1000, you have no matching user in your running Linux, thus you cannot access those files. When running multiple Linux versions or accessing files over NFS I suggest you use same UID for your user in all boxes.
^ this

Your user has a different UID/GID on the different systems, and Linux file permissions use UID/GID, not name. Your best bet is to migrate your UID/GID on one of the systems to match the other. You can do this by logging out as your user, logging in as root on a TTY, and running the following:
Code:
usermod -u newID "user"
groupmod -g newID "group"
find / -user oldID -exec chown newID {} \;
find / -group oldID -exec chgrp newID {} \;
Replacing oldID and newID with the ID you're changing from/to respectively.

Last edited by suicidaleggroll; 03-15-2016 at 03:17 PM.
 
Old 03-15-2016, 06:59 PM   #5
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484

Original Poster
Blog Entries: 15

Rep: Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163
Quote:
Originally Posted by rtmistler View Post
Code:
$ sudo chown -R <username> *
$ sudo chgrp -R <grpname> *
Are the first things I'd use, however for the chmod, you can also use the -R switch to cause it to be recursive.

Per Emerson's point, and why I posted the chmod/chown command examples, I had a similar situation with a LIVE boot USB that had the default user and mounted other flash drives were mounted as root thus making the mounted flash drives read-only to that default user. My solution was to do the first command and change all ownership and grouping of the entire mounted drive. That's a one-time thing unless I changed my LIVE boot system to something else, I usually don't.
Do I need to run those cmd's on all three distro's that have their own HDD's?
 
Old 03-15-2016, 07:12 PM   #6
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484

Original Poster
Blog Entries: 15

Rep: Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163
Quote:
Originally Posted by suicidaleggroll View Post
^ this

Your user has a different UID/GID on the different systems, and Linux file permissions use UID/GID, not name. Your best bet is to migrate your UID/GID on one of the systems to match the other. You can do this by logging out as your user, logging in as root on a TTY, and running the following:
Code:
usermod -u newID "user"
groupmod -g newID "group"
find / -user oldID -exec chown newID {} \;
find / -group oldID -exec chgrp newID {} \;
Replacing oldID and newID with the ID you're changing from/to respectively.
You said to log in as root on a TTY. Do you mean a virtual terminal (console mode only)?

It is not clear to me what the oldID is and how would I arrive or create a name for the newID.
I've used the usermod cmd before but this is new to me.

Will the cmd's that you have advised me to run conflict with the ones that rtmistler has suggested and should I just go with one solution or do I need to perform both to fix the problem?

-::-Remember these 3 distro's are on 3 seperate drives each of their own in this desktop pc and I have to be very careful; it's not my machine.-::-
 
Old 03-15-2016, 08:40 PM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137
Yes a text-only console. You need to be COMPLETELY logged out of your regular user, if you run ps -ef you shouldn't see anything related to your normal user, as changing your UID can screw up any active processes.

The oldID is whatever it currently is. You should log into each of the three distros independently, and on each one open a terminal and run "id", then write down the uid and name and gid and name. Once you have this info for all of your distros, pick one the be the master, and change the other(s) to match. Then when you log into a distro, oldID would be whatever it was on the distro, and newID would be what you're changing it to.

chown and chgrp are not a good solution. You'd have to constantly change the permissions of all shared files/dirs back and forth every time you boot a different distro. It's not maintainable. Changing your UID/GID so they're the same on all distros, while a bit more involved, is a permanent solution.

Start by just logging into each distro and writing down your UID/name and GID/name for each of them, then we can go from there.
 
Old 03-15-2016, 09:09 PM   #8
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484

Original Poster
Blog Entries: 15

Rep: Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163
Quote:
Start by just logging into each distro and writing down your UID/name and GID/name for each of them, then we can go from there.
I can do that-
Just confirming....I need to run 'id' to get the UID name and the GID name?

Thanks for telling me that running chown and chmod is not the solution.
In this case a permanent solution is what the owner wishes and has faith that I can do it with your help.
 
Old 03-15-2016, 10:14 PM   #9
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 6,317

Rep: Reputation: Disabled
I do not want to confuse you, but it can done from running just one Linux installation, the one that has proper access to files.
Find out the UID/GID. Mount the other Linux and edit /etc/passwd and /etc/shadow and /etc/group, replace the IDs with correct ones. Then run chown -R <user>:<group> on home directory of this user. Done. Next time you boot into this Linux installation your user will have access to files.
 
Old 03-15-2016, 11:27 PM   #10
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484

Original Poster
Blog Entries: 15

Rep: Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163
Arch Linux 500 GB HDD

Code:
uid=0 (root) gid=0 (root), groups=0 (root), 1(bin), 2 (daemon), 3, sys, 4(adm), 6(disk), 10(wheel), 19(log)
Linux Mint 17 KDE 120 Hitachi HDD

Code:
uid=1000 (sifu) gid=1000 (sifu) groups=1000(sifu), 4(adm), 24(cdrom), 27(sudo), 30(dip), 46(plugdev), 108(lpadmin), 110(sambashare)
Linux Mint 17 Cinnamon 128 SSD

Code:
uid=1000 (sifu) gid=1000 (sifu) groups=1000 (sifu), 4(adm), 24(cdrom), 27(sudo),30(dip), 46(plugdev), 108(lpadm), 110(sambashare)
 
Old 03-16-2016, 04:35 AM   #11
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 6,317

Rep: Reputation: Disabled
Code:
grep sifu /etc/passwd
 
Old 03-16-2016, 08:15 AM   #12
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137Reputation: 2137
You ran id as root on the Arch system, it needs to be as your regular user.
 
Old 03-16-2016, 09:19 PM   #13
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484

Original Poster
Blog Entries: 15

Rep: Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163
Quote:
Originally Posted by suicidaleggroll View Post
You ran id as root on the Arch system, it needs to be as your regular user.
Sorry about that. Here's the correct output-

Code:
uid=1001(sifu), gid=1001(sifu),groups=1001(sifu), 7(lp), 10(wheel), 90(network), 91(video),
92(audio), 95(storage), 100(users)
 
Old 03-16-2016, 11:18 PM   #14
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,502

Rep: Reputation: 2617Reputation: 2617Reputation: 2617Reputation: 2617Reputation: 2617Reputation: 2617Reputation: 2617Reputation: 2617Reputation: 2617Reputation: 2617Reputation: 2617
i run into this issue with opensuse and scientific linux
root is 500 or 1000
and the first non root user is 501 or 1001

i share drives and data with the two OS's so the user name and uid need to be the same

in my case 1000 and 1001 for both os's
 
Old 03-16-2016, 11:21 PM   #15
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484

Original Poster
Blog Entries: 15

Rep: Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163
Quote:
Originally Posted by John VV View Post
i run into this issue with opensuse and scientific linux
root is 500 or 1000
and the first non root user is 501 or 1001

i share drives and data with the two OS's so the user name and uid need to be the same

in my case 1000 and 1001 for both os's
OK so how do I make the user name and the uid the same?
Use the usermod cmd?

Last edited by Ztcoracat; 03-16-2016 at 11:25 PM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Error opening /dev/sdb:Permission denied Neo@Matrix Linux - Newbie 20 09-20-2011 09:39 PM
excuting file resuls in permission denied error Panceisto Linux - Newbie 3 04-22-2010 03:12 AM
Acrobat Reader "error opening document - permission denied" Robhogg Linux - Software 5 04-25-2008 08:44 AM
Error opening type hash map aliases.db : permission denied Tazzmanian Linux - Software 2 08-24-2004 11:56 AM
permission denied when opening directory pilot1 Linux - General 1 10-23-2002 08:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:54 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