FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 03-05-2011, 08:14 AM
Thufir Hawat
 
Default chmod and chown recursion (sudo)

How do you recursively change the owner and add read/write permissions?
For some reason, http://apress.com/book/downloadfile/4045 seems to have
odd permissions? From time to time I seem to run across downloads like
this

Using chown recursively worked fine, but running, via sudo:

chmod +rw FaceletsEssentials/ *-Rv

didn't actually add read and write permissions (I suppose I really on
need read). Is there some trick to "forcing" this command to work as
sudo?


thanks,

Thufir


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-05-2011, 11:33 AM
vikash agrawal
 
Default chmod and chown recursion (sudo)

I guess if you do�
chmod 777�FaceletsEssentials/*�

will do the needful. ' * ' is a willdcard.

Regards

Vikasj
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-05-2011, 12:06 PM
Smoot Carl-Mitchell
 
Default chmod and chown recursion (sudo)

On Sat, 2011-03-05 at 09:14 +0000, Thufir Hawat wrote:
> How do you recursively change the owner and add read/write permissions?
> For some reason, http://apress.com/book/downloadfile/4045 seems to have
> odd permissions? From time to time I seem to run across downloads like
> this
>
> Using chown recursively worked fine, but running, via sudo:
>
> chmod +rw FaceletsEssentials/ -Rv
>
> didn't actually add read and write permissions (I suppose I really on
> need read). Is there some trick to "forcing" this command to work as
> sudo?

The umask bits are modifying the results when you do not specify the
leading ugo flags. I suspect root's umask is different than your own
umask. See the man page for details. This should work if you really
want to make the file tree readable and writable by everyone:

sudo chmod -R ugo+rw FaceletsEssentials

--
Smoot Carl-Mitchell
System/Network Architect
voice: +1 480 922-7313
cell: +1 602 421-9005
smoot@tic.com


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-05-2011, 12:50 PM
Thufir Hawat
 
Default chmod and chown recursion (sudo)

On Sat, 05 Mar 2011 18:03:13 +0530, vikash agrawal wrote:

> I guess if you do
>
> chmod 777 FaceletsEssentials/*
>
> will do the needful. ' * ' is a willdcard.
>
> Regards
>
> Vikasj


Unfortunately, that's the problem

thufir@tleilax:~/Desktop$
thufir@tleilax:~/Desktop$ ll facelet/
total 12
drwxr-xr-x 3 thufir thufir 4096 2011-03-04 22:28 ./
drwxr-xr-x 5 thufir thufir 4096 2011-03-05 03:20 ../
drwxrwxrwx 5 thufir thufir 4096 2008-06-22 06:15 FaceletsEssentials/
thufir@tleilax:~/Desktop$
thufir@tleilax:~/Desktop$ sudo chmod 777 facelet/*
thufir@tleilax:~/Desktop$
thufir@tleilax:~/Desktop$ ll facelet/FaceletsEssentials/
creatingAnApp/ pom.xml
tagReferenceAndComposite/
custom/ README.txt
thufir@tleilax:~/Desktop$ ll facelet/FaceletsEssentials/c
creatingAnApp/ custom/
thufir@tleilax:~/Desktop$ ll facelet/FaceletsEssentials/creatingAnApp/
ls: cannot access facelet/FaceletsEssentials/creatingAnApp/..: Permission
denied
ls: cannot access facelet/FaceletsEssentials/creatingAnApp/.: Permission
denied
ls: cannot access facelet/FaceletsEssentials/creatingAnApp/pom.xml:
Permission denied
ls: cannot access facelet/FaceletsEssentials/creatingAnApp/src:
Permission denied
total 0
d????????? ? ? ? ? ? ./
d????????? ? ? ? ? ? ../
-????????? ? ? ? ? ? pom.xml
d????????? ? ? ? ? ? src/
thufir@tleilax:~/Desktop$



-Thufir


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-05-2011, 12:55 PM
Thufir Hawat
 
Default chmod and chown recursion (sudo)

On Sat, 05 Mar 2011 06:06:37 -0700, Smoot Carl-Mitchell wrote:

> On Sat, 2011-03-05 at 09:14 +0000, Thufir Hawat wrote:
>> How do you recursively change the owner and add read/write permissions?
>> For some reason, http://apress.com/book/downloadfile/4045 seems to have
>> odd permissions? From time to time I seem to run across downloads like
>> this
>>
>> Using chown recursively worked fine, but running, via sudo:
>>
>> chmod +rw FaceletsEssentials/ -Rv
>>
>> didn't actually add read and write permissions (I suppose I really on
>> need read). Is there some trick to "forcing" this command to work as
>> sudo?
>
> The umask bits are modifying the results when you do not specify the
> leading ugo flags. I suspect root's umask is different than your own
> umask. See the man page for details. This should work if you really
> want to make the file tree readable and writable by everyone:
>
> sudo chmod -R ugo+rw FaceletsEssentials

I'll check the doc's, thanks. I'm not familiar with umask. Here are the
results of that command, which doesn't quite accomplish what I'd hoped
for:

thufir@tleilax:~/Desktop$
thufir@tleilax:~/Desktop$ sudo chmod -R ugo+rw facelet/
thufir@tleilax:~/Desktop$
thufir@tleilax:~/Desktop$ sudo ls facelet/FaceletsEssentials/
creatingAnApp/src/main/java/com/apress/myfaces/BirdFunctions.java
facelet/FaceletsEssentials/creatingAnApp/src/main/java/com/apress/myfaces/
BirdFunctions.java
thufir@tleilax:~/Desktop$
thufir@tleilax:~/Desktop$ ls facelet/FaceletsEssentials/creatingAnApp/src/
main/java/com/apress/myfaces/BirdFunctions.java
ls: cannot access facelet/FaceletsEssentials/creatingAnApp/src/main/java/
com/apress/myfaces/BirdFunctions.java: Permission denied
thufir@tleilax:~/Desktop$



thanks,

Thufir


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-05-2011, 04:54 PM
Smoot Carl-Mitchell
 
Default chmod and chown recursion (sudo)

On Sat, 2011-03-05 at 13:55 +0000, Thufir Hawat wrote:

> I'll check the doc's, thanks. I'm not familiar with umask. Here are the
> results of that command, which doesn't quite accomplish what I'd hoped
> for:
>
> thufir@tleilax:~/Desktop$
> thufir@tleilax:~/Desktop$ sudo chmod -R ugo+rw facelet/
> thufir@tleilax:~/Desktop$
> thufir@tleilax:~/Desktop$ sudo ls facelet/FaceletsEssentials/
> creatingAnApp/src/main/java/com/apress/myfaces/BirdFunctions.java
> facelet/FaceletsEssentials/creatingAnApp/src/main/java/com/apress/myfaces/
> BirdFunctions.java
> thufir@tleilax:~/Desktop$
> thufir@tleilax:~/Desktop$ ls facelet/FaceletsEssentials/creatingAnApp/src/
> main/java/com/apress/myfaces/BirdFunctions.java
> ls: cannot access facelet/FaceletsEssentials/creatingAnApp/src/main/java/
> com/apress/myfaces/BirdFunctions.java: Permission denied
> thufir@tleilax:~/Desktop$

Since it looks like the tree is on your desktop, it should be owned by
you. If you unpack a tar file with sudo the ownerships of the files
will be set to whatever is set in the tar archive. To fix you problem,
I'd just change the ownerships to yourself or just untar the tree
without using sudo. To change the ownership of the tree do:

sudo chown -R thufir facelet

--
Smoot Carl-Mitchell
System/Network Architect
voice: +1 480 922-7313
cell: +1 602 421-9005
smoot@tic.com


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-08-2011, 12:37 AM
MR ZenWiz
 
Default chmod and chown recursion (sudo)

On Sat, Mar 5, 2011 at 5:55 AM, Thufir Hawat <hawat.thufir@gmail.com> wrote:
> On Sat, 05 Mar 2011 06:06:37 -0700, Smoot Carl-Mitchell wrote:
>>
>> The umask bits are modifying the results when you do not specify the
>> leading ugo flags. *I suspect root's umask is different than your own
>> umask. *See the man page for details. *This should work if you really
>> want to make the file tree readable and writable by everyone:
>>
>> sudo chmod -R ugo+rw *FaceletsEssentials
>
> I'll check the doc's, thanks. *I'm not familiar with umask. *Here are the
> results of that command, which doesn't quite accomplish what I'd hoped
> for:
>

The umask is not involved when you do a chown or chmod. The problem
you are seeing is because ugo+rw does not give you execute (search)
permission on the directories. This is the correct command:

sudo chmod -R 777 <your directory here>

If that doesn't work, you may have other file or file system
corruption problems.

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-08-2011, 02:17 AM
Smoot Carl-Mitchell
 
Default chmod and chown recursion (sudo)

On Mon, 2011-03-07 at 17:37 -0800, MR ZenWiz wrote:
> On Sat, Mar 5, 2011 at 5:55 AM, Thufir Hawat <hawat.thufir@gmail.com> wrote:
> > On Sat, 05 Mar 2011 06:06:37 -0700, Smoot Carl-Mitchell wrote:
> >>
> >> The umask bits are modifying the results when you do not specify the
> >> leading ugo flags. I suspect root's umask is different than your own
> >> umask. See the man page for details. This should work if you really
> >> want to make the file tree readable and writable by everyone:
> >>
> >> sudo chmod -R ugo+rw FaceletsEssentials
> >
> > I'll check the doc's, thanks. I'm not familiar with umask. Here are the
> > results of that command, which doesn't quite accomplish what I'd hoped
> > for:
> >
>
> The umask is not involved when you do a chown or chmod. The problem
> you are seeing is because ugo+rw does not give you execute (search)
> permission on the directories. This is the correct command:
>
> sudo chmod -R 777 <your directory here>
>

Check the man page on chmod. The umask does effect the results. Also
the ugo+rw *adds* the bits indicated and does not affect bits already
set in the permission.

Try this:

smoot@smoot:~/tmp$ mkdir test
smoot@smoot:~/tmp$ umask
0002
umask only masks the "other" 'w' bit -e.g. 2nd bit from the right.
umask = 000 000 000 010 in binary.

smoot@smoot:~/tmp$ cd test
smoot@smoot:~/tmp/test$ touch a b
smoot@smoot:~/tmp/test$ chmod 444 *
smoot@smoot:~/tmp/test$ ls -l
total 0
-r--r--r-- 1 smoot smoot 0 2011-03-07 20:02 a
-r--r--r-- 1 smoot smoot 0 2011-03-07 20:02 b
smoot@smoot:~/tmp/test$ chmod +w *
smoot@smoot:~/tmp/test$ ls -l
total 0
-rw-rw-r-- 1 smoot smoot 0 2011-03-07 20:02 a
-rw-rw-r-- 1 smoot smoot 0 2011-03-07 20:02 b

Note the "other" 'w' bit is unaffected by the chmod +w * command.

sudo which inherits the root users umask which is typically 022 will not
affect the 'w' bit for the group and other.

If the search 'x' bit was not set on a directory, you will get a
permission denied message as a normal user. With sudo it overrides the
permissions, since it is running with root privileges.

--
Smoot Carl-Mitchell
System/Network Architect
voice: +1 480 922-7313
cell: +1 602 421-9005
smoot@tic.com


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-08-2011, 07:25 AM
MR ZenWiz
 
Default chmod and chown recursion (sudo)

On Mon, Mar 7, 2011 at 7:17 PM, Smoot Carl-Mitchell <smoot@tic.com> wrote:
:
> Check the man page on chmod. *The umask does effect the results. *Also
> the ugo+rw *adds* the bits indicated and does not affect bits already
> set in the permission.
>
Here is what I see:

$ umask
0002
$ ll EmpHist.odt
-rw-rw-r-- 1 mar users 10589 2010-07-07 15:43 EmpHist.odt
$ chmod 777 EmpHist.odt
$ ll EmpHist.odt
-rwxrwxrwx 1 mar users 10589 2010-07-07 15:43 EmpHist.odt*
$ alias ll
alias ll='/bin/ls -lF'
$

Note that the umask had no effect. Now:

$ sudo -i
# umask
0022
# ll scsrun.log
-rw-rw-r-- 1 root root 224 2010-04-16 18:33 scsrun.log
root@markbase:~ # chmod 777 scsrun.log
root@markbase:~ # ll scsrun.log
-rwxrwxrwx 1 root root 224 2010-04-16 18:33 scsrun.log*
root@markbase:~ # exit
logout

$ sudo umask
sudo: umask: command not found
$

> Note the "other" 'w' bit is unaffected by the chmod +w * command.
>
That's not what I see - even if I use the ugoa controls:

$ ll EmpHist.odt
-rw-rw-r-- 1 mar users 10589 2010-07-07 15:43 EmpHist.odt
$ chmod ugo+w EmpHist.odt
$ ll EmpHist.odt
-rw-rw-rw- 1 mar users 10589 2010-07-07 15:43 EmpHist.odt
$

The umask had no effect on the chmod.

> sudo which inherits the root users umask which is typically 022 will not
> affect the 'w' bit for the group and other.
>
See above.

> If the search 'x' bit was not set on a directory, you will get a
> permission denied message as a normal user. *With sudo it overrides the
> permissions, since it is running with root privileges.
>
That's true - OP didn't have a problem listing the directories in
sudo, but when he did not use sudo, the error on the directory popped
up.

It's possible that my system has some bizarro settings that are
causing this to be different from what you are seeing, or the man page
- wouldn't be the first time. However, I have not messed with
anything that I know of which might be responsible for such a change.
(Ideas welcome.)

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-08-2011, 02:53 PM
Smoot Carl-Mitchell
 
Default chmod and chown recursion (sudo)

On Tue, 2011-03-08 at 00:25 -0800, MR ZenWiz wrote:
> On Mon, Mar 7, 2011 at 7:17 PM, Smoot Carl-Mitchell <smoot@tic.com> wrote:
> :
> > Check the man page on chmod. The umask does effect the results. Also
> > the ugo+rw *adds* the bits indicated and does not affect bits already
> > set in the permission.
> >
> Here is what I see:
>
> $ umask
> 0002
> $ ll EmpHist.odt
> -rw-rw-r-- 1 mar users 10589 2010-07-07 15:43 EmpHist.odt
> $ chmod 777 EmpHist.odt

The explicit octal permission bits are not affected by the umask. Nor
are the explicit ugo "symbolic" bits. It is only when you "wildcard"
the permission bits by not specifying the "ugo" "symbolic bits does the
umask enter into the algorithm. e.g

chmod +rw filename ...

only affect the permission bits which are not masked by umask.

If you go back and look at the original post, the poster was not
explicitly calling out the permission bits.

--
Smoot Carl-Mitchell
System/Network Architect
voice: +1 480 922-7313
cell: +1 602 421-9005
smoot@tic.com


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 07:44 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org