LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 02-12-2010, 06:16 PM   #1
mecelec415
Member
 
Registered: Jan 2008
Location: Noble Park ,Victoria, Australia
Distribution: Mageia
Posts: 183
Blog Entries: 2

Rep: Reputation: 23
chown files


I want to chown a few complete partitons to my user so i can clean up , delete and edit my files.
how can i chown a folder so i own every file in it?
if i chown like this
Code:
chown steve:steve store1/steves\ personal\ stuff/
i can write to the folder but i dont own the existing files in the said folder (notice how konsole shows spaces).
mandriva 2010
 
Old 02-12-2010, 06:38 PM   #2
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
To change the ownership recursively, use option -R:

Code:
chown -R steve:steve store1/steves\ personal\ stuff/
see chown(1).
 
1 members found this post helpful.
Old 02-12-2010, 09:32 PM   #3
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 mecelec415 View Post
I want to chown a few complete partitons to my user so i can clean up , delete and edit my files.
how can i chown a folder so i own every file in it?
if i chown like this
Code:
chown steve:steve store1/steves\ personal\ stuff/
i can write to the folder but i dont own the existing files in the said folder (notice how konsole shows spaces).
mandriva 2010
You cannot chown a folder so you own every file in it; you need to chown each file individually.

You do not need to own files to delete them; you only need write and execute (= search when on a directory) permissions on their parent directory to delete them. Practically you also need read permission on the parent directory so you can list them too.
Code:
c@CW8:/tmp$ mkdir test.dir
c@CW8:/tmp$ ls -ld test.dir
drwxr-xr-x 2 c users 4.0K Feb 13 08:37 test.dir
# root creates a file in test.dir
root@CW8:/tmp/test# touch test.file
c@CW8:/tmp$ ls -l test.dir/
total 0
-rw-r--r-- 1 root root 0 Feb 13 08:45 test.file


# Set directory permissions to the minimum required to be able to delete files in it
c@CW8:/tmp$ chmod 300 test.dir
# We cannot now list the files within it
c@CW8:/tmp$ ls -l test.dir/
ls: cannot open directory test.dir/: Permission denied
c@CW8:/tmp$ ls -ld test.dir/
d-wx------ 2 c users 4096 Feb 13 08:53 test.dir/
# Remove the file
c@CW8:/tmp$ rm test.dir/test.file
rm: remove write-protected regular empty file `test.dir/test.file'? y


# Set directory permissions to the minimum required to list files in it 
c@CW8:/tmp$ chmod 500 test.dir/
c@CW8:/tmp$ ls -ld test.dir/
dr-x------ 2 c users 4096 Feb 13 08:53 test.dir/c@CW8:/tmp$ ls -l test.dir/
total 0
 
  


Reply



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
How to chown entire folders and files and subs? natbrazil Linux - Newbie 7 04-13-2008 11:22 PM
Chown/Chmod ff Directories/Files Question Genin Linux - Newbie 4 12-27-2006 11:51 AM
simple question - how to chown ALL files in a dir? flipwhy Linux - Newbie 5 08-29-2006 05:54 PM
help with chmod chown on cdrom copied files spacklebird Linux - Software 2 11-19-2003 12:48 AM
chmod vs chown on some root files and yes apps ergo_sum Linux - Newbie 3 11-12-2003 10:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva

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