Categories: Snippets

Change ownership of the directory in ubuntu

The chown command has the following syntax:

chown username:groupname directory

So in your example command it is your primary group name you need to put To determine your current user name issue the command as below on a terminal

whoami

This will return your current user name. Then issue this command to determine your group memberships

groups username

Assuming that your username is “myuser”, run:

groups myuser

You will get something like:
myuser : myuser staff adm cdrom lpadmin admin

The first one after the : is your primary group. In this example it is “myuser”.

The command will be:

sudo chown -R root:myuser /var/lib/php/session

Recent Posts

How To Troubleshoot Socket Errors in MySQL – Ubuntu

MySQL manages connections to the database server through the use of a socket file, a special…

5 years ago

How to remove .html, .php, etc (extension) from URL?

To remove the .html extension from your urls, you can use the following code in…

5 years ago

Ubuntu with Apache2: Installing and Configuring Your SSL Certificate

Use free/paid SSL certificates https://www.sslforfree.com Enable SSL Module Replace 'default-ssl' with the real site name…

5 years ago

Create zip archive excluding specific Files & Directories

Create archive of all files under public_html directory ignoring all files and folders including text…

6 years ago

how to use sudo command to install .tar.gz?

To install some file *.tar.gz, you basically would do: Open a console, and go to…

6 years ago

failed to retrieve share list from server connection refused ubuntu 18.04

How to Save: To save in nano use "CTRL-O", then "CTRL-X". Tip: Replacing sudo nano with gksudo gedit gives you a…

6 years ago