Linux - Change Permissions and Ownership for Files and Folders (chmod, chown, members, groups )

Поделиться
HTML-код
  • Опубликовано: 18 сен 2019
  • Find code and diagrams at: www.EliTheComputerGuy.com
    The commands chown and chmod allow you to change permissions and ownership of files and folders, but you also need to know the membership of groups to make sure permissions and ownership is appropriate.
    View Group Membership
    groups - shows groups you belong to
    groups username - shows groups user belongs to
    cat /etc/group | less - Allows you to view Group file that has all groups and members
    members groupname - Shows members of a specific group
    Members is not installed by default in Ubuntu. Install with: sudo apt-get install members
    Change Ownership of Files and Folders
    chown owner:group file - Changes Account Owner and Group Owner of File
    chown :group file - Changes Group Owner of File
    chwon -R owner:group folder - Changes Account Owner and Group Owner of Folder and changes contents recursively
    Change Permissions
    chmod 777 file - Changes permissions of file so that Account Owner can RWX, Group Owner can RWX, and Everyone can RWX
    chmod -R 777 folder - Changes permissions of Folder and Contents so that Account Owner can RWX, Group Owner can RWX, and Everyone can RWX
    -R is for recursive which means the contents of the folder will be changed also
  • НаукаНаука

Комментарии • 58

  • @cravarc
    @cravarc 4 года назад +2

    Thank you. This video was just what I needed... at the perfect pace, and explained so clearly! Subscribed!

  • @michaeldasch9820
    @michaeldasch9820 2 года назад

    Man, was stuck on this problem for about 3-4 hours..... found this video and was able to figure it out. Thanks so much for sharing your knowledge with the world. May god bless you

  • @andonigamezsuarez3210
    @andonigamezsuarez3210 2 года назад +1

    Thank you very much. This is the best tutorial I have ever seen about linux permissions and ownerships. Congratulations to you, cause the video goes directly to the point. With channels like this, this world gets better.
    You get a new sub, and a thumbs up cause this video.
    A BRIVE SUMMARY FOR YOU GUYS:
    Changing Permissions and Ownerships for Files and folders:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Showing the groups and members:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Showing the groups of the current user:
    groups
    Showing the groups of other users:
    groups username
    Showing members of a group, You'll have to previously install it:
    sudo apt install members -y
    members groupname
    Showing all the existence os groups:
    cat /etc/group
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Changing ownerships
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Changing owner and group owner:
    sudo chown user:group filename
    Changing just the owner:
    sudo chown username filename
    Changing just the group owner:
    sudo chown :group filename
    Changing folder permisions, be careful, you have to bear in main the files that contains.
    Changing permisons recursively:
    sudo chown -R user:gorup filename
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Changing permissions
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    You have to add to give various permissions:
    0 = Denied
    1 = Excute
    2 = Write
    4 = Read
    Example: sudo chmod user|group|others filename -->
    sudo chmod 740 filename
    In case of changing folder permisions, we can do it recursively:
    sudo chmod -R 740 foldername

  • @vedantshinde2277
    @vedantshinde2277 2 года назад

    Oh my god, Thank you so much!! I blindly used chmod to "remove the lock icon" without knowing the bts. Finally restored permissions for the user and this video just saved the day for me.

  • @nathanmillar16
    @nathanmillar16 3 года назад +1

    Quality. Thank you for explaining this!

  • @JJPRETORIUS
    @JJPRETORIUS 4 года назад

    THANK YOU after hours of searching for a solution yours worked the first time Thanks a mil

  • @Cielcity
    @Cielcity 4 года назад +1

    Thank you so much for these classes! I am the only girl on my class and i am glad that I can look smart as the guys on my class.. 🤗😍 thank you so much

    • @dropshotking1212
      @dropshotking1212 4 года назад +1

      Thats dope!! When i was in high school i was a jock... i was the only jock that took computer classes and was always made fun of... I hope that you stick it to them guys good!! Remember "LADIES are PIMPS too..."

  • @shantiswarupmahapatra5000
    @shantiswarupmahapatra5000 3 года назад

    Hey man! You are really awesome in your explanations

  • @1minutelinux390
    @1minutelinux390 4 года назад

    Thank you , great explanation.

  • @jessicajurado9414
    @jessicajurado9414 Год назад

    Really handy. Thank you!

  • @user-yb6oc4tj2w
    @user-yb6oc4tj2w 3 года назад

    subscribed for this video ❤️

  • @dontatme1499
    @dontatme1499 4 года назад +14

    I love this man no homo

  • @md.arifurrahman9563
    @md.arifurrahman9563 4 года назад

    Thanks a bunch!

  • @kadadajuma6029
    @kadadajuma6029 Год назад

    hi this is what i really needed thank you alot

  • @jovan_script
    @jovan_script 2 года назад

    Thanks, man!

  • @vineeshbc9448
    @vineeshbc9448 Год назад

    Thanks a lot... this ved saved my half day 👌🥳🙏

  • @cyberguide_in
    @cyberguide_in 4 года назад +2

    Hi Eli, could you please also create a video on "special permissions like setuid, setgid and sticky bit" ?
    I appreciate your work! Thank you!

  • @justinm7912
    @justinm7912 4 года назад +2

    how do u give different permissions to different types of groups, so instead of working with the group that owns the file, you are changing the permissions of multiple groups that use the file

  • @ithelpers4625
    @ithelpers4625 2 года назад

    Thank you :)

  • @juanjoseaguero6539
    @juanjoseaguero6539 4 года назад +1

    Great video !! Please could you explain about File System, processes, services, kernel, run level, etc....it would be very interesting!

  • @bodob280
    @bodob280 3 года назад

    thank you vary much sir

  • @CarlyMonster
    @CarlyMonster 3 года назад

    THANK YOU!!!

  • @poonambharara9068
    @poonambharara9068 4 года назад

    Thank you so much, Sir, I really learned a lot and enjoyed this video:)

  • @ninonazghaidze7687
    @ninonazghaidze7687 4 года назад

  • @cherten1
    @cherten1 3 года назад

    Love this video. I need the video you did prior to this. This video builds on it. Videos aren't number and don't know the name. Can anyone help.
    Don't know what you dofull time but if it is not teaching you missed your calling. Video precise, volume good (no freaky music) just make it a little big in size. You have a new subscriber

  • @leondennis4659
    @leondennis4659 4 года назад +1

    I wish you could increase the font size or zoom in so I can see better.

  • @dropshotking1212
    @dropshotking1212 4 года назад

    so putting 000 should lock the folder and files if done : chmod -R 000 Documents/ \\\ but it shows a pad lock on the folder and files but i can still click on all of them...????

  • @Bigmoosemanswiggan
    @Bigmoosemanswiggan 3 года назад

    what if you're trying to change the owner of a hard drive?
    I used the KDE partition editor to wipe a hard drive and made a new partition/partition table. Everything works just fine but I can't write anything in the drive, only read

  • @linuxinside6188
    @linuxinside6188 4 года назад +1

    Finally This channel Monetized .. 🎉🎉🎉🎉🎈

  • @jakeames6840
    @jakeames6840 4 года назад

    Eli, My USB stick just has read permissions, how do I do w and x? Do I have to do the same on all USB ports? I have Linux Ubuntu. Thanks. I have autocad drawings that the printer cannot open up.

  • @ryansgale22
    @ryansgale22 3 года назад

    I made an external hard drive in Linux Mint auto mount in the path /media/data how do I change the permissions? When I right click the hard drive and go to the permissions tab I get the message ( The permissions of "data" could not be determined. )

  • @senthamizhanrajendran1739
    @senthamizhanrajendran1739 3 года назад

    I'd mounted a removable usb drive in a folder through fstab. But, I'm not able to change the ownership of the mounted folder. When I tried chown it says "operation not permitted" . can you help me to solve this? I'm using Ubuntu mate running on raspberry Pi 3b

  • @mahabooblinux
    @mahabooblinux 3 года назад

    nice

  • @cherten1
    @cherten1 3 года назад

    How to change permissions in batch config. Wanted to install Bacula app but error no permissions for batch config.
    ???

  • @climbingshitmountain
    @climbingshitmountain Год назад

    what if you are attempting to change folder ownership but the folder has the same name as a file??

  • @swoondrones
    @swoondrones Год назад

    What about hidden folders? How do I get the path in terminal?

  • @victoriadathan2675
    @victoriadathan2675 3 года назад +1

    Why is the execute permission separated by a dash in the second portion of the permissions, that is r-x?? I don't get it.

  • @markusscott6696
    @markusscott6696 2 года назад

    with command $groups I can see only few groups, but with command $cat /etc/groups a whole bunch of groups. Shouldn't that be the same?

  • @user-vn7ce5ig1z
    @user-vn7ce5ig1z 4 года назад +1

    I don't know why _ls_ doesn't have an option to view the permissions numerically (eg 755) instead of only as bitfields. :-|

    • @GodBreathed77
      @GodBreathed77 4 года назад

      - getfacl is a good alternative if you want to see more info. I got in the habit of visualizing the numbers by picturing me doing the action with a finger.
      Read = 4 (picture myself reading a book with 4 fingers)
      Write = 2 (I picture myself writing with a pencil with two fingers)
      Execute = 1 (I'm pointing with one finger to tell someone to do something)
      Not sure if that helps, but has worked well for me

    • @dropshotking1212
      @dropshotking1212 4 года назад

      Agreed!! That would be very helpful for changing back to defaults...

  • @aliciavegas5287
    @aliciavegas5287 3 года назад

    how can i replace a file to another user

  • @JESUS_IS_KING777
    @JESUS_IS_KING777 7 месяцев назад

    Please my termux change gid of _apt 3004 (inet) to 65534 (nogroup) and rewrite my etc/passwd and etc/shadow and my etc/group...please help me

  • @KartonDoBoZ
    @KartonDoBoZ 3 года назад

    OMG I am watching this video at Thu 11:10 am :O :O :O :O Lizard Nation

  • @NetworkEngineer
    @NetworkEngineer 4 года назад

    X.500 standard active directory

  • @andonigamezsuarez3210
    @andonigamezsuarez3210 2 года назад

    A BRIVE SUMMARY FOR YOU GUYS:
    Changing Permissions and Ownerships for Files and folders:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Showing the groups and members:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Showing the groups of the current user:
    groups
    Showing the groups of other users:
    groups username
    Showing members of a group, You'll have to previously install it:
    sudo apt install members -y
    members groupname
    Showing all the existence os groups:
    cat /etc/group
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Changing ownerships
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Changing owner and group owner:
    sudo chown user:group filename
    Changing just the owner:
    sudo chown username filename
    Changing just the group owner:
    sudo chown :group filename
    Changing folder permisions, be careful, you have to bear in main the files that contains.
    Changing permisons recursively:
    sudo chown -R user:gorup filename
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Changing permissions
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    You have to add to give various permissions:
    0 = Denied
    1 = Excute
    2 = Write
    4 = Read
    Example: sudo chmod user|group|others filename -->
    sudo chmod 740 filename
    In case of changing folder permisions, we can do it recursively:
    sudo chmod -R 740 foldername

  • @queenbyhim3574
    @queenbyhim3574 Год назад

    I have files on my employer shared drive, I work from home online and I'm convinced someone is going in and altering files. It's a windows system. How can I stop them from modifying, copying, replacing, and removing files in my folers

    • @queenbyhim3574
      @queenbyhim3574 Год назад

      Also how can I stop them from changing permissions I have set

  • @gabbermensch
    @gabbermensch 4 года назад

    Anyone else think this man looks like a handsome version of Ari Shaffir?

  • @AccuphaseMan
    @AccuphaseMan 4 года назад

    Did anyone else notice how he says "change"

  • @KenSherman
    @KenSherman 2 года назад

    chmod 🆚chown...

  • @PodCashUSA
    @PodCashUSA 4 года назад +1

    3:40 you're welcome

  • @Baucan
    @Baucan 3 года назад

    No, Linux sucks, you can not easily copy files around, need permission bla bla bla.. since 8 hours I'm trying to copy ONE file to the File sytem and can not... :-( I'm thinking seriously at this point to go back Windows....