Solved

CHMOD on folders - How do I know what the current CHMOD is on a folder? What ones are there?  Linux N00b

Posted on 2011-03-15
11
522 Views
Last Modified: 2012-05-11

Ive a linux friend helping me with Samba.
I don’t want to ask him everything.

Chmod will be changed on a few shares.
I would like to compare the CHMODs that are there now before they are changed to see what has been done and better understand.

So how do I know the current CHMOD on a folder?
 

0
Comment
Question by:fcek
  • 5
  • 4
  • 2
11 Comments
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 125 total points
ID: 35139191
ls -ld foldername
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 375 total points
ID: 35139225
With CHMOD you mean permissions, don't you?

Check permissions of a folder (a "directory" in Linux!) with

ls -ld directoryname

The first 9 characters are the ones you're searching for.

The first one indicates the type (directory (d), regular file (-), link (l) etc).

The next three triplets indicate permissions (r=read, w=write, x=execute/scan) for owner, group, others.

Octal representation is 4=read, 2=write, 1=execute, so

drwxr-xr-x

is actually a directory with octal permissions 755.

wmp
0
 

Author Comment

by:fcek
ID: 35141489

Hi what chmod is the most open for a folder - Im setting up a share and only one user on samba can access it.  Two others cant.

The two that cant are listed in " give access to these users"
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 375 total points
ID: 35141619
Which kind of access are you talking about? Read, Write, Execute/Scan?

The most open setting is "rwx", obviously, so the command to give these permissions to  "others" (i.e. users neither owning the directory nor being members of the group owning it) would be:

chmod o+rwx directory

See "man chmod" for details!

wmp
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35141668
chmod 777 foldername

is the most you can get.  It gives total permission for everything  -- not a very good practice though

you can also do

chmod -R 777 folder
would make the least restrictive permissions for the folder and its contents.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:fcek
ID: 35141881



Is there a way to see the current permissions or chmod status on a folder?

I have a working example on another server but dont want to change it, but would be interested in copying its permissions on its shares to see the result.
 

0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 35141904
See my very first comment!
0
 

Author Comment

by:fcek
ID: 35142270




drwxrwxrwx. 18 root root 4096 Mar  8 19:16 users-personal
[ed@server1 users folders]$ ls -ld admin-private
drwxrwxrwx. 5 root root 4096 Mar 15 03:55 admin-private
[ed@server1 users folders]$ ls -ld admin-public
drwxrwxrwx. 2 root public 4096 Mar 14 22:52 admin-public

Not knowing Linux / Samba - I cant tell what mod this is in this example.  
They all appear to be the same mod.
What mod?


 





0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 375 total points
ID: 35142314
As I wrote - look at my very first comment!

Anyway, here you go:

First letter "d" - directory
First triplet "rwx" - read/write/scan for owner "root"
Second triplet "rwx" - read/write/scan for group "root"
Third triplet "rwx" - read/write/scan for "all others"

That's the same as "777" or, in the symbolic form "ugo=rwx"

0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 35142347
Btw. that's the most open setting you can have. Open like a barn door for just everyone.
0
 

Author Comment

by:fcek
ID: 35142445

woolmilkporc:

That was very well explained there!
My pall is not explaining things very well to me!

And thanks to everyone else as well.

You all have the patience of Jobe!
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

Suggested Solutions

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now