How can I add a script to nautilus for running selected file as administrator (not open as administrator)? And if it is possible, I want to run this file as administrator without entering my password.
Information on using sudo or gksudo on scripts without password
You need to do the following, on the terminal type
Now you can run the specified commands without password as long as you type that command with
ie: lets you want to run
To create a scrip use your favorite editor to create a
Use sudo to call commands that need it, it wont ask for password as long as you added that on the
After that you need to make it executable with:
Now you can run your script using
Create a right-click "Open as admin" without password
To create a scrip that opens files using administrator permissions by right clicking on them and making it so that no passwords will be asked create a script with the following:
Save it on your
You should be able to right-click a file, move to your scripts folder and selecting the script you just created to open that file using root permistions.
Nautilus scripts usually are to be placed in
You can access that script from nautilus by right clicking on the file, hovering over the script menu and then clicking on the filename of the script in
There is no secure way you can do this with arbitrary files without entering your password. For special commands the process is described in brunopereira81's post here and uses sudo but depending on the commands will lead to a vulnerable system. If you don't care (and I strongly advice against this) you can set
You can use this Nautilus extension. Nautilus-gksu /
When you need to open any files with root permission, you just have to right-click on the file, select 'Open as Administrator', as simple as that.
For more cool extensions visit : http://www.techdrivein.com/2010/09/6-useful-nautilus-extensions-and.html