LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-21-2016, 10:51 AM   #1
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Rep: Reputation: Disabled
chmod


Quote:
chmod - change file mode bits

Synopsis: chmod [OPTION]... MODE[,MODE]... FILE...

Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'.
Here are my interpretations for the regex used:
Code:
[ugoa]*   where * means zero or more
Should * be + instead since we NEED at least one for specifying the mode, not zero of [ugoa]?

Code:
([-+=]([rwxXst]*|[ugo]))+     where  + means 1 or more of the outer parenthesis, (....).
Here the author indicates the parenthesis before the + can be repeated and at least one must exists,thus contradicting the asterisk in [ugoa]*.

Correct?

Last edited by fanoflq; 07-21-2016 at 10:53 AM.
 
Old 07-21-2016, 11:09 AM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Not correct

Quote:
Originally Posted by fanoflq View Post
Code:
[ugoa]*   where * means zero or more
Should * be + instead since we NEED at least one for specifying the mode, not zero of [ugoa]?
Why? You don't need to provide any of [ugoa], "chmod +x file" is perfectly valid. According to the man page:
Quote:
A combination of the letters ugoa controls which users' access to the
file will be changed: the user who owns it (u), other users in the
file's group (g), other users not in the file's group (o), or all users
(a). If none of these are given, the effect is as if a were given, but
bits that are set in the umask are not affected.
So if you don't provide one, "a" is assumed.

Quote:
Originally Posted by fanoflq View Post
Code:
([-+=]([rwxXst]*|[ugo]))+     where  + means 1 or more of the outer parenthesis, (....).
Here the author indicates the parenthesis before the + can be repeated and at least one must exists,thus contradicting the asterisk in [ugoa]*.
How is that a contradiction? You don't need to provide [ugoa], but you do need to provide a permission modification, otherwise what's the point in running chmod?

Last edited by suicidaleggroll; 07-21-2016 at 11:10 AM.
 
1 members found this post helpful.
Old 07-21-2016, 12:23 PM   #3
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
@suicidaleggroll:

This was what I missed.problem solved. Thank you.

Quote:
..... If none of these are given, the effect is as if a were given, but
bits that are set in the umask are not affected.
 
Old 07-21-2016, 01:56 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,996

Rep: Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187Reputation: 3187
As usual, a great deal of your questions would be answered by simply reading the man pages instead of asking so many questions about them. You can trust that tried and tested commands, such as chmod,
would be extremely unlikely to give you invalid information. So this being the case, the answer will often be in the detailed writing of the man page in question.
 
1 members found this post helpful.
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sticky Bit? (ie: chmod 2770 vs chmod 770) JeffC1 Linux - Newbie 7 03-18-2010 07:39 AM
Apache: difference between chmod 644 and chmod 666 and chmod 600 for output/txt/dat? frenchn00b Programming 6 04-22-2009 01:10 PM
chmod 775 to only the directories and chmod 664 to only the files? apachenew Linux - Security 6 09-27-2007 03:26 PM
chmod, external usb, vfat - can't chmod a directory itsjustme Slackware 2 04-02-2006 04:23 PM
CHMOD in shell : chmod 777 /usr/ <---is that right? cpanelskindepot Programming 5 07-16-2004 05:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:44 AM.

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