如何以Root的身份打开文件!!(很经典的命令,希望对你有帮助)

来源:百度文库 编辑:神马文学网 时间:2024/04/28 19:46:52
Ubuntu: Easy (And Quick) Ways To Open Any Files As Root

root-privilege.jpgUbuntu does not allow its users to login as root directly. For users who want to run programs (or edit files) with root privileges, they have to use “sudo” to allow access to root. While this is a very useful feature to protect your system, it can be a troublesome and repetitive task.

Instead of hitting the terminal and enter the ‘sudo‘ command everytime you need to open a file with root privilege, you can use any of the following methods to easily access your files with a mouse click.

1) Create a gksudo Launcher

    * Right-click unused space in either the top or bottom panel.
    * Choose “Add To Panel…”
    * Choose Custom Application Launcher
    * In the window that pops up, enter the following:
      Name: GKSudo launcher
      Command: gksudo “gnome-open %u”
      Comment: Open files with root privilege
    * Click the No Icon button to select an icon for your launcher.
    * Click OK

Your Gksudo launcher should now appear on the panel.

Now, to open a file with root privilege, just drag and drop the file to this launcher.

2) Install ‘nautilus-gksu’

Install ‘nautilus-gksu‘ via the Synaptic Package Manager. Now when you right click on any files or folder, you can see the option “Open as administrator“.

3) Use nautilus-script

If for some reason, you can’t install the ‘nautilus-gksu‘, you can achieve the same function via creating a nautilus script manually.

In the terminal,

gedit $HOME/.gnome2/nautilus-scripts/Open\ as\ Administrator

Insert the following lines into the new file:

for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do gksudo “gnome-open $uri” & done

Save the file.

Make the file executable:

chmod +x $HOME/.gnome2/nautilus-scripts/Open\ as\ Administrator

You can now open files as root by right clicking on the file and selecting Scripts->Open as Administrator


4) addition:

did it this way Name: GKSudo launcher
Command: gksudo “gnome-open %u”
Comment: Open files with root privilege

im on ubuntu 10.04 i did it with " gksudo gnome-terminal "
it would not work with your gksudo “gnome-open %u”
hope this helps others


如何以Root的身份打开文件!!(很经典的命令,希望对你有帮助) 引用 生活:希望对你的人生有帮助 引用 生活:希望对你的人生有帮助 我的考证经历,希望对你有帮助 我的荨麻疹好了,希望对你有帮助 电脑高手常用的5个按钮,希望对你有帮助 女朋友生气了...请你这样挽回...转来的...希望对你有帮助... - Qzone日志 女朋友生气了...请你这样挽回...转来的...希望对你有帮助 XP有一个很无敌的命令(可 以用来删除不能删除的文件) 希望这些话能打开你的心结......经典 做对你有帮助的笔记 会对你的人生很有帮助的-无价之宝 很值得看的,对你很有帮助 - 很值得看的,对你很有帮助 - [原创]八年脱发者的止脱经历和总结!希望对你有帮助[中国脱发论坛] [原创]八年脱发者的止脱经历和总结!希望对你有帮助[中国脱发论坛]22 [原创]八年脱发者的止脱经历和总结!希望对你有帮助[中国脱发论坛]22 【散分】公布一些常用的WebServices,希望对大家的应用有帮助~ Win7的30个技巧,,转载,希望对安装win7的朋友有帮助 介绍的MACD希望对初学的朋友有帮助和启发 如果真的有心进入交易这一行,请读一下下面的书,如果仅仅只是业余爱好,可以有选择的读。希望对你有帮助 经典彩色全手掌对应的穴位,希望对大家有所帮助! 经典彩色全手掌对应的穴位,希望对大家有所帮助! 经典彩色全手掌对应的穴位,希望对大家有所帮助