【问题标题】:Cannot enter in centOS with any user [closed]无法使用任何用户进入centOS [关闭]
【发布时间】:2013-02-18 19:36:25
【问题描述】:

我使用的是 cent OS 操作系统,没有 GNOME

一开始会问

localhost login:
Password:

在组名service下有一个名为service的用户,其密码也是service

我想通过这个名为 service 的用户进入操作系统。

当我这样做时,它会显示这一行

Last Login: Mon Feb 18 16:16:26 on tty1
-bash: /home/service/.bashrc: Permission denied
-bash-3.2$

我在 /etc/sudoers 中进行了更改,并在 root ALL=(ALL) ALL 正下方添加了 service ALL=(ALL) ALL >,但它没有工作。

当我尝试从 root 切换到服务时,它显示相同的错误。

已编辑

当我运行ls -a -l | grep .bashrc 时,它显示

lrwxrwxrwx 1 root  root   41 Feb 18 11:40 .bashrc -> /home/service/etc/version.symlink/.bashrc
-rw-r--r-- 1 service service 124 Feb 15 13:06 .bashrc-moved-1361167832

帮帮我。期待您的善意回应。

【问题讨论】:

    标签: linux shell centos


    【解决方案1】:

    好吧,根据您的ls -a -l | grep .bashrc 命令的输出,我猜您必须以root 身份发出此命令:

    chown service:service /home/service/.bashrc
    

    【讨论】:

    • 是的,它可以工作,但是当我在这个名为“service”的用户中运行任何 shell 脚本时,它会给出Permission denied。为什么?
    • 当我在 ls 命令上面运行时,它给出了相同的输出
    • 真的非常非常感谢。现在我的问题解决了。 :)
    【解决方案2】:

    这与 sudo 无关。检查/home/service/.bashrc 的权限它应该归service:service 所有。该用户也应该可以阅读它。

    /home/service 本身应归service:service 所有,并且拥有rwx 所有者和rx 组的权限。

    【讨论】:

    • 我运行 ls -a -l | grep .bashrc ,它给出了输出,我写的是有问题的。检查编辑部分。
    猜你喜欢
    • 2014-10-23
    • 2013-06-02
    • 2013-04-01
    • 2016-02-10
    • 2021-11-02
    • 2016-09-04
    • 1970-01-01
    • 1970-01-01
    • 2021-07-04
    相关资源
    最近更新 更多