`

.ICEauthority的一连串事(原创)

阅读更多

使用Ubuntu和Fedora的用户经常会在进入GNOME时出现Could not update /home/$USER/.ICEauthority这样的提示。然后就不能正常进入GNOME了(之前在GNOME上的配置都消失了)

解决办法:以root的用户执行chown $USER:$USER -R  /home/$USER/

                                             chmod 644 /home/$USER/.ICEauthority

解决问题很简单,但为什么会出现这种情况呢?下面是我的一些个人理解

首先:先介绍下sudo和gksudo

sudo和gksudo都是使用root权限来执行应用,sudo执行程序时使用的是当前用户的配置和家目录,而gksudo使用的是root用户 的家目录和配置,一般情况下看不出什么区别,但是对于那些针对不同用户有不同的配置文件和表现形式的应用程序来说,这两种方式的结果区别就很明显了。比如 下面原文中举的firefox例子。在不通过终端运行程序时,sudo没有办法提供一个界面来输入管理员密码,比如在快捷方式中。还有些GUI程序只能用 gksudo。细心的朋友肯定发现了,在/root下并没有.ICEauthority。那么当用sudo运行程序之后,由于使用的是当前用户的配置和家 目录,

系统将整个家目录的所属者和所属组归属到root:root下,并将.ICEauthority的权限修改成600。故当再次以普通用户身份登入系统时,由于没有权限故无法读取用户的配置文件。根据上述分析,显然,当使用gksudo将能避免这种情况的发生。
一般情况下,可以这样,运行命令行程序时使用sudo,运行GUI程序时用gksudo。

下面是原文:

What’s the Issue?
Since most Ubuntu documentation asks you to use sudo even with graphical applications, I often get asked by Ubuntu users why I recommendgksudo or kdesu for graphical applications instead of sudo.

For example, a lot of guides (including the first book ever published about Ubuntu) will ask you to type this sort of command:

sudo gedit /etc/apt/sources.list


I will always recommend, however, that people use instead this sort of command:
gksudo gedit /etc/apt/sources.list

And reserve sudo for command-line applications, like so:
sudo nano /etc/apt/sources.list

Why is it an issue?
Well, to be perfectly honest, most of the time it isn’t. For a lot of applications, you can run them the improper way—using sudo for graphical applications and see no adverse side effects.

1. There are other times, though, when side effects can be as mild as Firefox extensions not sticking or as extreme as as not being able to log in any more because the permissions on your .ICEauthority changed. You can read a full discussion on the issue here.

These errors occur because sometimes when sudo launches an application, it launches with root privileges but uses the user’s configuration file.



For example, if you launch Firefox with the command
gksudo firefox
it uses root’s Firefox configuration file.

But if you launch Firefox with the command
sudo firefox

Change a few settings while launched as root, and you'll see if you dig into your Firefox profile that certain files are now owned by root.


it runs with root privileges but uses the user’s configuration file (in this case, you can see the homepage and theme are different).

2. Running graphical applications with sudo also has the downside of always having to be run from the terminal. If you don’t use the proper command—gksudo or kdesu, you will not be able to use the command as an icon launcher or keyboard shortcut because there will be no graphical dialogue box to enter your sudo password in.

3. There are also some graphical applications that simply will not run with the sudo command. Kate, for example, can be run as
kdesu kate

but cannot be run as
sudo kate

Why not make exceptions?
Bottom line: most of the time when you use sudo for graphical applications, it’s fine. Some of the time, though, it is not fine, and is, in fact, extremely bad.

If you made exceptions, you would have to give people a list of all the graphical applications that are okay to run as sudo and a list of all the graphical applications that must be run as gksudo or kdesu.

Why make a list that needs to be compiled and updated, that most people won’t refer to, and that is completely unnecessary? Just be consistent in suggesting good practice: gksudo and kdesu for graphical applications. sudo for command-line applications.

But gksudo sometimes gives me an error… even though it appears to work…


You may notice that even though gksudo is the proper way to launch graphical applications, if you launch a gksudo application it will sometimes give you what appears to be an error. This, for example:
(
gedit:####): GnomeUI-WARNING **: While connecting to session manager:
Authentication Rejected, reason : None of the authentication protocols specified are supported and host-based authentication failed.

or t hese


Initializing nautilus-gdu extension
Nautilus-Share-Message: Called "net usershare info" but it failed: 'net usershare' returned error 255: net usershare: cannot open usershare directory /var/lib/samba/usershares. Error No such file or directory
Please ask your system administrator to enable user sharing.
That is not a real error, and there’s already been a bug report filed on the message appearing. The developers have seen the bug and labeled it a low priority. In the meantime, just ignore the message and keep encouraging people to not use sudo for graphical applications so they won’t potentially mess up their ~/.ICEauthority and other user configuration files.

 

参考至:http://www.psychocats.net/ubuntu/graphicalsudo

原创文章,转载请注明出处、作者

如有错误,欢迎指正
邮箱czmcj@163.com

0
0
分享到:
评论

相关推荐

    java读写注册表jar包,com.ice.jni.registry

    META-INF/MANIFEST.MF com.ice.jni.registry.HexNumberFormat.class com.ice.jni.registry.NoSuchKeyException.class com.ice.jni.registry.NoSuchValueException.class com.ice.jni.registry.RegBinaryValue.class ...

    Java registry,com.ice.jni.registry

    com.ice.jni.registry.RegMultiStringValue.class com.ice.jni.registry.RegBinaryValue.class com.ice.jni.registry.RegistryException.class com.ice.jni.registry.NoSuchValueException.class ...

    最新java操作注册表的com.ice.jni.registry依赖压缩包

    这里提到的`com.ice.jni.registry`是一个Java库,它提供了这样的功能,利用JNI(Java Native Interface)技术实现了对注册表的原生访问。JNI是Java平台的一部分,允许Java代码和其他语言写的代码进行交互,特别是在...

    ubuntu9.10开机CouldnotupdateICEauthorityfile解决方法.pdf

    在Ubuntu 9.10操作系统中,用户可能会遇到“Could not update ICEauthority file”的错误,这是一个与图形界面登录相关的权限问题。ICEauthority文件是X Window System中用于存储认证信息的文件,它允许用户无须反复...

    com.ice.jni.registry

    标题中的"com.ice.jni.registry"是一个Java包名,暗示了这可能是一个Java库,专门用于处理与Windows注册表相关的操作。这个库利用JNI(Java Native Interface)技术,允许Java代码直接调用本地(通常是C或C++编写的...

    io.ice.app.MainApplication.apk

    io.ice.app.MainApplication.apk

    1.下载后将ice的后缀名改成mkv就可以播放啦.ice

    1.下载后将ice的后缀名改成mkv就可以播放啦.ice

    ice.fig.rar_ ice.fig_ice.fig_ice函数_matlab ice_matlab ice函数

    matlab ice.fig 函数源代码

    zeroc-ice 3.7.4源码.rar

    zeroc-ice 3.7.4源码.rar 压缩包中有 ice-3.7.4 ice-demos-3.7.4 Ice.framework3.7.4 freeze-3.7.4 IceBuilder ice-builder-gradle-1.4.7 ice-builder-visualstudio-6.0.0 ice-builder-xcode-3.1.0 源码包 ...

    ice.rar_ice matlab_ice.m matlab_matlab ice_matlab ice_matlab i

    本文将深入探讨名为"ICE"的MATLAB源码,它源自冈萨雷斯的《数字图像处理》一书,并结合提供的ice.m文件,解析其核心功能和实现原理。 "ICE"是Image Contrast Enhancement(图像对比度增强)的缩写,是数字图像处理...

    debezium-server-iceberg

    Debezium Iceberg消费者 该项目将冰山批处理使用者添加到有人可以使用此使用者并将数据库数据复制到iceberg表,而无需Spark,Kafka或Streaming平台。 iceberg消费者 将json事件附加到目标冰山表中,批大小由debezium...

    6.ICE.1-npm-webpack:火箭学院6.ICE.1-npm-webpack

    在"6.ICE.1-npm-webpack"这一主题中,我们将深入探讨这两个工具在软件工程基础中的应用,特别是针对SWE1(Software Engineering 1,软件工程基础)的学习。 首先,让我们从npm开始。npm是Node.js生态系统的一部分,...

    ZeroC Ice 3.7 手册

    ZeroC Ice 3.7 手册 Ice(Internet Communications Engine)是ZeroC公司的杰作,继承了CORBA的血统,是新一代的面向对象的分布式系统中间件。Ice是RPC通讯领域里最稳定、强大、高性能、跨平台、多语言支持的老牌开源...

    32位的ICE相关包

    mcpp-devel-2.7.2-2ice.rhel6.i386.rpm db48-4.8.30-1ice.rhel6.i386.rpm db48-devel-4.8.30-1ice.rhel6.i386.rpm db48-utils-4.8.30-1ice.rhel6.i386.rpm db48-java-4.8.30-1ice.rhel6.i386.rpm ice-3.4.2-1....

    Icestudio-cli:用于在命令行中使用.ice icestudio文件的小型实用程序

    用于在命令行中使用.ice icestudio文件的小型实用程序 测试文件 用于测试的Icestudio文件位于Test-files文件夹中 test-01-info.ice :它仅包含一个基本信息块 外部node.js模块 :在命令行上打印颜色 快速开始 安装...

    c#整合zeroIce

    6. **客户端调用**:在C#客户端,同样需要生成对应的代理类,然后创建`Ice.Communicator`实例,通过代理类调用远程服务。 7. **异常处理**:ZeroIce提供了丰富的异常机制,确保在通信过程中捕获和处理可能出现的...

    linux ubuntu 扩大根目录.docx

    运行以下命令以确保用户对`.ICEauthority`文件的正确权限: ```bash sudo chown $USER:$USER /home/$USER/.ICEauthority sudo chmod 644 /home/$USER/.ICEauthority ``` 8. **安全检查** - 在确认系统稳定运行...

    Ice-3.7.4.msi for windows版

    Exception in thread Ice.ConnectionRefusedException error = 0 at IceInternal.Network.doFinishConnect(Network.java:417) at IceInternal.TcpTransceiver.initialize(TcpTransceiver.java:33) at Ice....

    Ice-3.4.0.msi

    Ice-3.4.0.msi Ice-3.4.0.msi Ice-3.4.0.msi

Global site tag (gtag.js) - Google Analytics