chown [path to user's home directory (i.e. /home/user) -R username.username.
假设您有用户“foo”。您可以执行以下命令:
chown -R foo.foo /home/foo
添加一点 for 循环,您可以一下子更改权限:(假设您使用的是 bash):
for i in /home/*; do name=`basename $i`; chown -R $name.$name $i; done
您现在应该能够以任何用户身份登录。
There really is no need to re-install or any other such drastic measures. With a little work the system will be fine, as long as you still have root access.
You used the phrase "won't boot into any user account." From that I take you to mean that the system will boot you just can't log in as any user other than root.
On any linux distro almost all files on the system except those in /home/[USERNAME] are owned by root.
You are most likely authenticating as the other users just fine, but since their config files, etc. are owned by root the system cannot complete the login process. You can easily verify this by checking /var/log/auth.log
The first thing I'd do is fix the file and directory permissions on the various user directories in /home to the appropriate user and group. This can be done from /home with a simple command.
chown is the program you want. Read the man page for more info but basically just:
chown [path to user's home directory (i.e. /home/user) -R username.username.
Say for instance you had user 'foo'. You'd execute this command:
chown -R foo.foo /home/foo
Add a little for loop and you could change the perms in one fell swoop: (assuming you're using bash):
for i in /home/*; do name=`basename $i`; chown -R $name.$name $i; done
You should now be able to log in as any user just fine.
发布评论
评论(2)
确实没有必要重新安装或任何其他此类严厉措施。只要您仍然拥有 root 访问权限,只需做一些工作,系统就可以正常工作。
您使用了短语“不会启动到任何用户帐户”。从这里我认为您的意思是系统将引导,您只是无法以 root 以外的任何用户身份登录。
在任何 Linux 发行版上,除了 /home/[USERNAME] 中的文件之外,系统上几乎所有文件都归 root 所有。
您很可能可以像其他用户一样进行身份验证,但由于他们的配置文件等由 root 用户拥有,因此系统无法完成登录过程。您可以通过检查 /var/log/auth.log 轻松验证这一点。
我要做的第一件事是将 /home 中各个用户目录的文件和目录权限修复为适当的用户和组。这可以通过一个简单的命令从 /home 完成。
chown 就是你想要的程序。阅读手册页以获取更多信息,但基本上只是:
假设您有用户“foo”。您可以执行以下命令:
添加一点 for 循环,您可以一下子更改权限:(假设您使用的是 bash):
您现在应该能够以任何用户身份登录。
There really is no need to re-install or any other such drastic measures. With a little work the system will be fine, as long as you still have root access.
You used the phrase "won't boot into any user account." From that I take you to mean that the system will boot you just can't log in as any user other than root.
On any linux distro almost all files on the system except those in /home/[USERNAME] are owned by root.
You are most likely authenticating as the other users just fine, but since their config files, etc. are owned by root the system cannot complete the login process. You can easily verify this by checking /var/log/auth.log
The first thing I'd do is fix the file and directory permissions on the various user directories in /home to the appropriate user and group. This can be done from /home with a simple command.
chown is the program you want. Read the man page for more info but basically just:
Say for instance you had user 'foo'. You'd execute this command:
Add a little for loop and you could change the perms in one fell swoop: (assuming you're using bash):
You should now be able to log in as any user just fine.
原来的系统就无法启动了。
可能
/home
和/etc
,Knoppix 是一个很好的系统,可用于访问和恢复第一个驱动器,或者您可以尝试引导 Debian 本身(从另一个磁盘或 CD)来执行此操作。
The original system won't boot anymore.
Probably
/home
and/etc
,Knoppix is a good system to use to access and restore the first drive, or you could try to boot Debian itself (from another disk or a CD) to do that.