Tutorials Hut

  • Unix For Testers

       Introduction to Unix
       Unix System Architecture
       Unix File System Structure
       Absolute and Relative Path
       Basic Unix Commands
       cal command in Unix
       who command in Unix
       date command in Unix
       clear command in Unix
       more command in Unix
       whoami command in Unix
       uname command in Unix
       man command in Unix
       echo command in Unix
       Unix File System Commands
       ls command in Unix
       cat command in Unix
       cp command in Unix
       mv command in Unix
       pwd command in Unix
       cd command in Unix
       mkdir command in Unix
       rmdir command in Unix
       rm command in Unix
       touch command in Unix
       dirname command in Unix
       tar command in Unix
       Unix Links(ln)
       Hard Link
       Soft Link
       Regular Expressions
        Basic Regular Expressions
       Interval Regular Expressions
       Pipes and Filters
       Unix Text Processing Commands
       cmp command in Unix
       diff command in Unix
       comm command in Unix
       cut command in Unix
       Paste command in Unix
       head command in Unix
       tail command in Unix
       wc command in Unix
       sort command in Unix
       grep command in Unix
       Process Related Command
       top command in Unix
       ps command in Unix
       nice command in Unix
       Kill command in Unix
       nohup command in Unix
       time command in Unix
       File Tranfer Commands in Unix
       file transfer using scp command
       file transfer using rlogin command
       file transfer using telnet command
       ssh(Secure Shell) command in Unix
       ftp file transfer command
       sftp file transfer command
       chmod command in Unix
       File Permission and File Security in Unix



  • Setting permission and changing ownership (chmod, chown)

     

    File permissions are determined by who owns the file and the visibility of that file. chown and chmod are the tools we use to manipulate ownership and access. chown is used to change the owner, not the group.

    chmod 

    The chmod command stands for “change mode”, and allows changing permissions of files and folders, also known as “modes” in UNIX. 

      • Used for setting file and directory permissions.
    Syntax:
    Chmod [OPTION] [Mode][Mode].. Filename

    Using Absolute Mode:

    chmod [0-7][0-7][0-7] filename/dir

    Using Symbolic Mode:

    chmod [ugo][+-=][rwx] filename

    where + adds specified mode

     – removes specified mode

    = assigns specified mode  for u/g/o

    Option

    Use

    -R

    To change the file and directory permissions recursively

    –reference

    Utilize permissions of first argument as reference to set permissions of remaining arguments

    Example:

      1. Chmod -R 755 /home/Data/task1

    ls -l /home/Data/task1

    Output:

    drwxr-xr-x

     umask

    New files are created with a default set of permissions. Specifically, a new file’s permissions may be restricted in a specific way by applying a permissions “mask” called the umask. The umask command is used to set this mask, or to show you its current value.

      • Stands for user creation mask.
      • Sets default permissions for a newly created file and directory.
      • Default value is 022.
      • The value can be changed.
    Syntax:
    unmask

    chown 

    The chown command stands for “change owner”, and allows changing the owner of a given file or folder, which can be a user and a group.

      • Changing ownership for a file.
      • Can be done only by the owner and root or administrator.
    Syntax :

    To change owner of the file:

    chown username filename
    Recommended Articles:

    Leave a Reply

    Your email address will not be published. Required fields are marked *