Changing Permissions

J

John P

Guest
How can I make this Data partition be readable and writeable? I tried the "chmod 777" command, but was unsure of what directory to type in . I tried several but the command wouldn't start. This partition is on the second hardrive. I am just trying to get more storage on the second hard drive, so I hope I partitioned correctly. The drive was originally mounted as usr, but I managed to shrink that and make a new partition named Data.
Screenshot.png
 


The whole partition? First, you need to check to see if it was mounted rw or ro. Do that by looking at /etc/mtab or /proc/mounts.

If it's mounted rw, then you can worry about permissions. Note that chmod takes both the permissions, and the path to which they are to be applied. You a can also specify that the change be applied recursively. I'd recommend reading (and understanding) the man page for chmod, because if you mess things up by chmodding the wrong path, you can really screw your system up.

If you aren't the owner of the path in question, you'll need to be root to change it.
 
You may want to look into changing the owner of the drive with chown and changing the owning group with chgrp as well as @GrumpyOldMan 's suggestions.
 
Just concerned with the "Data " partition.
Not sure of how to do what you said in the first sentence:
(First, you need to check to see if it was mounted rw or ro. Do that by looking at /etc/mtab or /proc/mounts)
Can you explain exactly how to do that?
Also, am I not in root when I am in the terminal and I type a command?
 
OK, here is what I found under mtab:

/dev/sda2 / ext4 rw,errors=remount-ro 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
sysfs /sys sysfs rw,noexec,nosuid,nodev 0 0
none /sys/fs/cgroup tmpfs rw 0 0
none /sys/fs/fuse/connections fusectl rw 0 0
none /sys/kernel/debug debugfs rw 0 0
none /sys/kernel/security securityfs rw 0 0
udev /dev devtmpfs rw,mode=0755 0 0
devpts /dev/pts devpts rw,noexec,nosuid,gid=5,mode=0620 0 0
tmpfs /run tmpfs rw,noexec,nosuid,size=10%,mode=0755 0 0
none /run/lock tmpfs rw,noexec,nosuid,nodev,size=5242880 0 0
none /run/shm tmpfs rw,nosuid,nodev 0 0
none /run/user tmpfs rw,noexec,nosuid,nodev,size=104857600,mode=0755 0 0
none /sys/fs/pstore pstore rw 0 0
/dev/sda3 /home ext4 rw 0 0
/dev/sda1 /boot ext4 rw 0 0
/dev/sdb1 /usr ext4 rw 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,noexec,nosuid,nodev 0 0
systemd /sys/fs/cgroup/systemd cgroup rw,noexec,nosuid,nodev,none,name=systemd 0 0
gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse rw,nosuid,nodev,user=randy 0 0


and under mounts:
rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
udev /dev devtmpfs rw,relatime,size=1008844k,nr_inodes=252211,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=204840k,mode=755 0 0
/dev/disk/by-uuid/92d15c39-dd88-4872-bac6-2a7706b654b1 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
none /sys/fs/cgroup tmpfs rw,relatime,size=4k,mode=755 0 0
none /sys/fs/fuse/connections fusectl rw,relatime 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
none /sys/kernel/security securityfs rw,relatime 0 0
none /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
none /run/shm tmpfs rw,nosuid,nodev,relatime 0 0
none /run/user tmpfs rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755 0 0
none /sys/fs/pstore pstore rw,relatime 0 0
/dev/sda3 /home ext4 rw,relatime,data=ordered 0 0
/dev/sda1 /boot ext4 rw,relatime,data=ordered 0 0
/dev/sdb1 /usr ext4 rw,relatime,data=ordered 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
systemd /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,name=systemd 0 0
gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0

Does this help explain anything?
 
Code:
sudo chown -R / USERNAME /media/randy/Data
Code:
sudo chmod 777 /media/randy/Data
 
I don't see /dev/sdb2 listed in there at all, which suggests to me that it's not even mounted at this point. You may need to mount it first. If you just did the shrink and create routine, it's likely that it didn't automount.

So, first try:
sudo mkdir -p /media/randy/data
sudo mount /dev/sdb2 /media/randy/data

Next question is: Is this a detachable drive (i.e. USB/eSata/whatever) or a permanently installed one?

Also, unless you are actually logged in as root (which most distros prevent, as it's an exploit waiting to happen), you aren't root in a terminal. You need to either execute the su command to switch to root (and provide the root password) or use sudo to execute a single command as root (in which case, you'll need your own password, and you have to be in the sudoers file, not always the default on some distros, like Debian). It's difficult to do these things for a reason. Having root permissions is like being able to use a circular saw without a blade guard - you can do some things you couldn't ordinarily do, but you can also cut your hand off more easily.

If it's just a data partition (and not one with operating system file or applications on it), changing permissions/ownership like @ryanvade suggests won't cause a catastrophe. Doing that on, say, /usr will likely end in tears.
 
Ryanvade....Are those two command lines what I need to put in terminal to get things to work?
Also you typed in "USERNAME"...should I type that in just as you did or is that the computer password?
 
Grumpyoldman, I thought I installed operating system on the first disk as I have a boot, root and home folder there....I wasn't sure what to do with the second disk so I had the mount point as usr. I removed the second disk and tried to start the computer but it would look for the usr mount point and would not start up. I then replaced the hard drive back in and it started fine. Thats when I realized that I needed to keep the usr mount point somewhere, but I shrank it down to 6 gigs, and named the rest of the second drive "Data" hoping I could then use it for additional storage, so I hope that portion is not usr anymore? Here is some more info if that will help:

randy@randy-HP-Pavilion-dv9000-RG335UA-ABA ~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 22G 1.8G 20G 9% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 986M 4.0K 986M 1% /dev
tmpfs 201M 1.4M 199M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1001M 76K 1001M 1% /run/shm
none 100M 40K 100M 1% /run/user
/dev/sda3 85G 432M 80G 1% /home
/dev/sda1 3.7G 74M 3.4G 3% /boot
/dev/sdb1 6.3G 4.6G 1.4G 78% /usr


Still not sure about how to type in Ryanvades command lines?
 
First, where @ryanvade has USERNAME, you put your login name, not password.

Second, what you did when you set the mount point of the partition of your second drive as /usr was to tell the installer to put most of the binaries your computer will use on that partition. If it's there, all is well, and you can still use the second partition for data. By disconnecting the drive, you took away most of the program files the operating system needs to run.

What you really wanted to do was to have the second drive as all one partition, and have it's mount point being /home. If you haven't got very far, the best solution by far is to re-do the install. Make two partitions on the first disk - one for swap, sized for 2x the amount of RAM you have and at the end of the drive, not the beginning, and the rest for everything else but home. Then format the second drive for one partition, and have that mount on /home. This way, all your data will go on the second drive, and all the operating system stuff will go on the first.

If this is your first install, don't fret. I've had to redo many setups myself. If you can just redo it, no loss. If you can't, what you'll need to do is to make a directory inside /home/USERNAME, and modify /etc/fstab so that /dev/sdb2 will mount there.
 
BTW, usr supposedly originally stood for "Unix System Resources", not an abbreviation for "User".
 
Grumpyoldman,
OK, I think I'm beginning to understand. This is the first time installing on a laptop with two hard drives. I have done four other installs but with only one drive. I thought I could have two home partitions, and when it wouldn't let me choose a second /home on the second drive I chose /usr. Now I know that was wrong.
This install is for a friend, and I tried to install Mint 13 on it. All went well until I added Dropbox and it when into an install loop that was a known bug. I wiped that out and now installed Mint17.1. I put all the addons, including Kodi and all runs well. Except I can't use the second drive.I looked for tutorials on how to install with two hardrives but only found dual boot info. I would hate to start all over again :-(
Before I go any further here is the etc/mtab and proc/mounts info updated with the drive mounted if it makes any difference in which way I go with this.

/dev/sda2 / ext4 rw,errors=remount-ro 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
sysfs /sys sysfs rw,noexec,nosuid,nodev 0 0
none /sys/fs/cgroup tmpfs rw 0 0
none /sys/fs/fuse/connections fusectl rw 0 0
none /sys/kernel/debug debugfs rw 0 0
none /sys/kernel/security securityfs rw 0 0
udev /dev devtmpfs rw,mode=0755 0 0
devpts /dev/pts devpts rw,noexec,nosuid,gid=5,mode=0620 0 0
tmpfs /run tmpfs rw,noexec,nosuid,size=10%,mode=0755 0 0
none /run/lock tmpfs rw,noexec,nosuid,nodev,size=5242880 0 0
none /run/shm tmpfs rw,nosuid,nodev 0 0
none /run/user tmpfs rw,noexec,nosuid,nodev,size=104857600,mode=0755 0 0
none /sys/fs/pstore pstore rw 0 0
/dev/sdb1 /usr ext4 rw 0 0
/dev/sda1 /boot ext4 rw 0 0
/dev/sda3 /home ext4 rw 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,noexec,nosuid,nodev 0 0
systemd /sys/fs/cgroup/systemd cgroup rw,noexec,nosuid,nodev,none,name=systemd 0 0
gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse rw,nosuid,nodev,user=randy 0 0
/dev/sdc1 /media/randy/306A-2060 vfat rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2 0 0
/dev/sdb2 /media/randy/Data ext4 rw,nosuid,nodev,uhelper=udisks2 0 0


and this
rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
udev /dev devtmpfs rw,relatime,size=1008844k,nr_inodes=252211,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=204840k,mode=755 0 0
/dev/disk/by-uuid/92d15c39-dd88-4872-bac6-2a7706b654b1 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
none /sys/fs/cgroup tmpfs rw,relatime,size=4k,mode=755 0 0
none /sys/fs/fuse/connections fusectl rw,relatime 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
none /sys/kernel/security securityfs rw,relatime 0 0
none /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
none /run/shm tmpfs rw,nosuid,nodev,relatime 0 0
none /run/user tmpfs rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755 0 0
none /sys/fs/pstore pstore rw,relatime 0 0
/dev/sdb1 /usr ext4 rw,relatime,data=ordered 0 0
/dev/sda1 /boot ext4 rw,relatime,data=ordered 0 0
/dev/sda3 /home ext4 rw,relatime,data=ordered 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
systemd /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,name=systemd 0 0
gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
/dev/sdc1 /media/randy/306A-2060 vfat rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro 0 0
/dev/sdb2 /media/randy/Data ext4 rw,nosuid,nodev,relatime,data=ordered 0 0

Assuming I don't want to reinstall everything again, can you please go over the command lines I need to put in including the ones from Ryanvade?
P.S....
By doing the fix method will I still have access to storage on the first drive or will the /home be only on the second drive? It would seem like a waste of two 120 gig drives to only be able to write to one drive. Thanks for your help and patience!
 
OK, looking at mtab, you now have the second drive mounted (and accessible at) /media/randy/Data. At this point, I'd try the following command:

ln -s /media/randy/Data ~/Data

What that command will do is create a symbolic link in your home directory named Data which will point at the second partition of your second drive.

That should make your data drive accessible via home all the time that drive is present (and mounted, which is always if it's internal).

So, try that one command, and then try these two:

cd ~/Data
touch diditwork

The first command will switch to that directory (which should be the second drive), and the second one will create an empty file named "diditwork". Then assuming no error messages, do this:

ls /media/randy/Data

and see if diditwork is there. If so, you're good. Anything you save in Data in your home directory (or ones nested below it) will go into the second drive, and anything you save anywhere else in your home directory won't.
 
Copied and pasted those commands and pressed enter with these results:

with drive unmounted:
randy@randy-HP-Pavilion-dv9000-RG335UA-ABA ~ $ ln -s /media/randy/Data ~/Data
ln: failed to create symbolic link ‘/home/randy/Data’: File exists

randy@randy-HP-Pavilion-dv9000-RG335UA-ABA ~ $ cd ~/Data
bash: cd: /home/randy/Data: No such file or directory
randy@randy-HP-Pavilion-dv9000-RG335UA-ABA ~ $ touch diditwork
randy@randy-HP-Pavilion-dv9000-RG335UA-ABA ~ $


with drive mounted:
randy@randy-HP-Pavilion-dv9000-RG335UA-ABA ~ $ ln -s /media/randy/Data ~/Data
ln: failed to create symbolic link ‘/home/randy/Data/Data’: Permission denied

randy@randy-HP-Pavilion-dv9000-RG335UA-ABA ~ $ cd ~/Data
randy@randy-HP-Pavilion-dv9000-RG335UA-ABA ~/Data $ touch diditwork
touch: cannot touch ‘diditwork’: Permission denied
randy@randy-HP-Pavilion-dv9000-RG335UA-ABA ~/Data $

seems like nothing worked at all. I thought I put in the password the first time but it made no difference. Do I need to put sudo also?
 
The problem with doing stuff like this via a forum is the latency.

do this:

ls -l /media/randy

And put the results here.
 
OK here are the results:
with second drive mounted:

randy@randy-HP-Pavilion-dv9000-RG335UA-ABA ~ $ ls -l /media/randy
total 20
drwx------ 6 randy randy 16384 Dec 31 1969 306A-2060
drwxr-xr-x 3 root root 4096 Feb 26 14:54 Data


with drive unmounted:

randy@randy-HP-Pavilion-dv9000-RG335UA-ABA ~ $ ls -l /media/randy
total 16
drwx------ 6 randy randy 16384 Dec 31 1969 306A-2060
 
Next question: Does this second drive's data partition mount automatically at startup, or do you have to do that?

Also, what's the output of:

ls -l ~
 
When I first turn on the computer the second drive is not mounted at all...( which I don't understand because the /usr is on that drive)
Anyway the results are:


results with drive mounted:

randy@randy-HP-Pavilion-dv9000-RG335UA-ABA ~ $ ls -l ~
total 57824
-rw------- 1 randy randy 205508608 Feb 25 12:09 core
lrwxrwxrwx 1 randy randy 17 Feb 27 15:29 Data -> /media/randy/Data
drwxr-xr-x 2 randy randy 4096 Feb 27 08:49 Desktop
-rw-r--r-- 1 randy randy 0 Feb 27 15:37 diditwork
drwxr-xr-x 2 randy randy 4096 Feb 26 15:03 Documents
drwxr-xr-x 2 randy randy 4096 Feb 25 10:40 Downloads
-rw-r--r-- 1 randy randy 736 Feb 25 12:09 kodi_crashlog-20150225_120953.log
drwxr-xr-x 2 randy randy 4096 Feb 25 10:40 Music
drwxr-xr-x 2 randy randy 4096 Feb 25 10:40 Pictures
drwxr-xr-x 2 randy randy 4096 Feb 25 10:40 Public
drwxr-xr-x 2 randy randy 4096 Feb 25 10:40 Templates
drwxr-xr-x 2 randy randy 4096 Feb 25 10:40 Videos


with drive unmounted:

randy@randy-HP-Pavilion-dv9000-RG335UA-ABA ~ $ ls -l ~
total 57824
-rw------- 1 randy randy 205508608 Feb 25 12:09 core
lrwxrwxrwx 1 randy randy 17 Feb 27 15:29 Data -> /media/randy/Data
drwxr-xr-x 2 randy randy 4096 Feb 27 08:49 Desktop
-rw-r--r-- 1 randy randy 0 Feb 27 15:37 diditwork
drwxr-xr-x 2 randy randy 4096 Feb 26 15:03 Documents
drwxr-xr-x 2 randy randy 4096 Feb 25 10:40 Downloads
-rw-r--r-- 1 randy randy 736 Feb 25 12:09 kodi_crashlog-20150225_120953.log
drwxr-xr-x 2 randy randy 4096 Feb 25 10:40 Music
drwxr-xr-x 2 randy randy 4096 Feb 25 10:40 Pictures
drwxr-xr-x 2 randy randy 4096 Feb 25 10:40 Public
drwxr-xr-x 2 randy randy 4096 Feb 25 10:40 Templates
drwxr-xr-x 2 randy randy 4096 Feb 25 10:40 Videos
 
Grumpyoldman,
FYI...Back when I tried to shrink the second drive which was all /usr, Gparted wouldn't let me do it. It said I needed to unmount the drive, and when I tried through Gparted it couldn't do it. I then tried though the Disk manager and still no luck. I found that I needed to insert the installation disk and while in the "Live environment" I was able to shrink the /usr to the least amount allowed which was 6 gigs. The remainder of the drive I named "Data". It took a while to shrink but was successful. And thats where I am now. I hope this helps clarify some more...
 
John P - seems you are missing much of the background to make this stuff easy. There are lots of beginning Linux books which teach fundamentals, in a specific order, so that knowledge builds on previously taught concepts. That is where forums like this and google breaks down - until you get a base set of knowledge.
http://linuxcommand.org/tlcl.php has a free PDF book, or you can buy it at any bookstore you like. Read the first 100 pgs to get the multi-user aspects and overall philosophy then skim the rest to know what it covers and get an idea for how hard something is based on where it is in the book.

And don't forget this stuff is fun!
 

Staff online

Members online


Top