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 - Наука
Thank you. This video was just what I needed... at the perfect pace, and explained so clearly! Subscribed!
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
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
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.
Quality. Thank you for explaining this!
THANK YOU after hours of searching for a solution yours worked the first time Thanks a mil
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
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..."
Hey man! You are really awesome in your explanations
Thank you , great explanation.
Really handy. Thank you!
subscribed for this video ❤️
I love this man no homo
Thanks a bunch!
hi this is what i really needed thank you alot
Thanks, man!
Thanks a lot... this ved saved my half day 👌🥳🙏
Hi Eli, could you please also create a video on "special permissions like setuid, setgid and sticky bit" ?
I appreciate your work! Thank you!
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
Thank you :)
Great video !! Please could you explain about File System, processes, services, kernel, run level, etc....it would be very interesting!
thank you vary much sir
THANK YOU!!!
Thank you so much, Sir, I really learned a lot and enjoyed this video:)
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
I wish you could increase the font size or zoom in so I can see better.
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...????
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
Finally This channel Monetized .. 🎉🎉🎉🎉🎈
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.
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. )
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
nice
How to change permissions in batch config. Wanted to install Bacula app but error no permissions for batch config.
???
what if you are attempting to change folder ownership but the folder has the same name as a file??
What about hidden folders? How do I get the path in terminal?
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.
@Heber gonzalez lol
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?
I don't know why _ls_ doesn't have an option to view the permissions numerically (eg 755) instead of only as bitfields. :-|
- 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
Agreed!! That would be very helpful for changing back to defaults...
how can i replace a file to another user
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
OMG I am watching this video at Thu 11:10 am :O :O :O :O Lizard Nation
X.500 standard active directory
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
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
Also how can I stop them from changing permissions I have set
Anyone else think this man looks like a handsome version of Ari Shaffir?
Did anyone else notice how he says "change"
chmod 🆚chown...
3:40 you're welcome
Thank you sooo much :)))
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....