190 likes | 273 Views
Let’s log on using Secure Shell. Permissions. You can set permissions for accessing your files, and you should do this. From within a directory or subdirectory, issue a ls –l command (those are letter ls not numeral 1s) This will list the subdirectories and files within ‘that’ subdirectory.
E N D
Permissions • You can set permissions for accessing your files, and you should do this. • From within a directory or subdirectory, issue a ls –l command (those are letter ls not numeral 1s) • This will list the subdirectories and files within ‘that’ subdirectory. • You can then issue a change feature (ahead) to allow / prevent certain accesses. • Typically you will use something like: (change modifications) $ chmod 755 myfile.c <return> This gives total permissions to you and read and execute permissions to ‘group’ and ‘others’ (more ahead)
Setting File Permissions 5 5 7 1 1 1 1 0 1 1 0 1 $ chmod 755 filename
Setting File Permissions • chmod command • To set file permissions • Syntax: $chmod UGO <file name> • Where U=user, G=group, and O=other • Setting permissions to directories • Use the execute (x) to grant access
Setting File Permissions • DO NOT CHANGE COMMANDS UNTIL YOU UNDERSTAND ALL OF THIS!!! • Practice: • $chmod 700 a_file • $chmod 640 a_directory • $chmod 604 a_file • The system you are learning is referred to as octal represented. • How else can I change user permissions with the chmod command?
Setting File Permissions • Basic Unix permissions are broken up into three groups: • Owner - Can manage own files • Group -Everyone in group manages files • Others - Everyone in the world manages files
Setting File Permissions • There are three Unix file permissions: • Read (4) • You may read this file • Write (2) • You may write/delete this file • Execute (1) • You may execute this file (binary or script) • Unlike Windows, the filename's extension means nothing to the operating system. However, it is important for maintenance to follow some convention.
Setting File Permissions • Common permission 1: • Owner: Read, Write • Group: Read • World: Read • Common permission 2: • Owner: Read, Write, Execute • Group: Read, Execute • World: Read, Execute • Common permission 3: • Owner: Read, Write, Execute • Group: Read, Execute • World: nothing
Setting File Permissions • Each letter has a value: r=4, w=2, x=1 • Add them up to determine their meaning. • rw (read/write) = (r+w) = (4+2) = 6 • rwx (read/write/execute) = (r+w+x) = (4+2+1) = 7 • rx (read/execute) = (r+x) = (4+1) = 5 owner group world | | | ----- ----- ----- | | | | | |- - - - - - - - - -d r w x r w x r w x