I'm new to Ubuntu and need to create a new folder in /var
and need all users on the machine to have full permissions to this folder.
How should I proceed?
Press Ctrl+Alt+T to go to a terminal and type:
sudo mkdir /var/szDirectoryName
sudo chmod a+rwx /var/szDirectoryName
Where szDirectoryName
is the name of the directory you would like, a
means "all" (users) +
means "add the following rights" and rwx
means r
ead, w
rite and ex
ecute respectively...
Note: there already is such a directory in /var
which all users have access to: tmp
(full path: /var/tmp
) which itself is symlinked to /tmp
.
Beware however that all files in /tmp
are deleted at boot time.
For any further information, here is a great resource on all directories in Linux.
-bash: cd: folder: Permission denied
, when trying cd folder
Commented
May 14, 2022 at 17:56
Open Terminal
Create Directory with mkdir
:
sudo mkdir /var/DirectoryName
To give all permissions to a folder give chmod -R 777
:
sudo chmod -R 777 /var/DirectoryName
Below gives all permissions to everybody to all files and subdirectories:
chmod -R a+rwx path
To give all permissions to all the users, use the following command:
chmod -R a+rwx /path/....
Note: It's Usually not recommended to give every user every permission of a directory, be careful while using this command.
To give permissions to a specific user:
sudo chown -R username:grouname /folder_path
/var
that has full permission for all users??? There is already one! and it's calledtmp
!quiet splash
from the boot parameters...) ;-)