Hey there! any question in your mind? Ask It Now!.

Popular Categories

Ubuntu-change permission of a file after becoming root

+2 votes
asked in Programming by Anita Sah
I was trying to execute a .sh file, permission denied was coming . I am using Ubuntu and for executing .sh file how to change permission from root? thanks for help!

1 Answer

+1 vote
answered by Himanshu Expert (5,940 points)

Its very simple you need to become root by this command 


sudo - i       // to become root


Now cd to the file path like example below :

cd    /path/to/file path

 Now we can change permission by this command :

chmod +x filename.sh

Now you can simply run .sh file like 


If you want to change the user so you can switch user like :

sudo -i -u username   // username is the user by which you are logged in.


In case of any query please comment.


Related Questions

+1 vote
3 answers 488 views
+7 votes
2 answers 758 views
+1 vote
1 answer 110 views
0 votes
1 answer 481 views

Not a Member yet?

Ask to Folks Login

My Account
276 Folks are online
0 members and 276 guest online
Your feedback is highly appreciated