LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Accessing locked files from normal user (http://www.linuxquestions.org/questions/slackware-14/accessing-locked-files-from-normal-user-536087/)

Lypur 03-09-2007 03:24 PM

Accessing locked files from normal user
 
Hey guys, i'm useing slackware 11.0. I just installed last week, and I searched under permissions etc, couldn't find exactly what i needed.

I've got a 300gb external hard drive. I've mounted it, and it's showing up. I loged into the root accound and copied some files over onto my internal hard drive. I can access and view all my files just fine logged in as root in the KDE...but once I log into my normal user accound, the system:/media/sda2/usb is locked. To by pass this. I logged into my root accound, and copied the files over from my external directly onto my normal user accounts desktop. So I've got the folders containing all the files. I can go into the folders, but all documents, pictures, music, videos, everything has a lock over it. I also tried loging back in as root and then right clicking on the folder of the external hard drive, and changing the permission for groups and others to few & modify it. When i log back into my normal account, I can get in, but still can't open the files. I went back into root, and checked the "appply to all subfolders and files" and then my system went very slow..evenually coming up with an error. I can't think of anything else, got any idea's?:scratch:

Quakeboy02 03-09-2007 03:26 PM

sudo chown userid fileid

or

sudo chown -R userid directory

If you want to keep the owner as root, then you'll need to do a man on "chmod" to see which permissions you want to change.

jschiwal 03-09-2007 04:02 PM

Read the "man mount" manpage. Changing options in your mount command, you will be able to mount the usb partition with either full ownership ( I am assuming fat32 usb drive ) with the options uid=yourusername or with full access to everyone with umask=0000.

To change the permissions on the files in your home directory, since they were converted for many of them, you could use the find command to find files owned by root and use the option -exec chmod yourusername:yourgroupname '{}' \; to change each file found.
sudo find directory -user root -exec chmod username:username

If I misunderstood you post, and you had tried to change the permissions of the files and directories on the external drive, you can't do that for vfat and ntfs filesystems. You change permissions for the partition and it's contents with mount options. ( You probably didn't mean that anyway, I'm just covering all the bases. )

jschiwal 03-13-2007 05:13 AM

I should have mentioned that for external drives it may be better to write a udev rule to run a hal helper program. This may depend on your distro. Some distro's don't have udev and some use hotplug instead of HAL.
Using "udevinfo -q all -n /dev/sda2" you can find a unique value to trigger the rule.

The problem is if you plug in another device, the device nodes may change. What was once /dev/sda2 may now be /dev/sdb3.

There was a post Saturday or Sunday referring to a howto on how to write the rule. Search this site for "hal" and "udev" and I'm sure you will find it.

If you always have the device plugged in, then it may not matter. In this case, use the "noauto" option anyway. Then if there is a problem with the external device, booting won't fail. Otherwise you will be dropped into the root shell, after entering the root password.


All times are GMT -5. The time now is 01:08 AM.