在不小心运行sudo chown -R test /之后

一时手贱把一些系统文件的owner修改为root,登录进去之后很多需要root权限的命令都不能运行,网上找了个解决方案:

1. 先切换到recovery模式,我这边是在系统开机自检(POST)之后,按住shift就进入了启动选项卡,选择recorvery模式,

2. 进入root shell控制界面

默认情况下整个分区是只读加载的,所以要运行mount -o remount,rw

重新将分区加载为可读写

3. 运行 chown -R root /,把所有文件的owner重新指定为root,

4. 运行 chown -R tristan /home/tristan,把用户目录的owner指向自己

这个时候进入系统没什么问题了。

然后网络连不上了,查看系统日志,发现

Mar  2 11:46:55 tristan-Satellite-L600 dbus[687]: [system] Activated service 'fi.w1.wpa_supplicant1' failed: The permission of the setuid helper is not correct
Mar  2 11:46:55 tristan-Satellite-L600 dbus[687]: [system] Activating service name='fi.w1.wpa_supplicant1' (using servicehelper)

然后菜单栏里的synaptic也运行不起来,然后查找到其对应的exe的名字在shell中运行,发现the permission of the setuid helper is not correct

网上搜了下,需要修改/usr/lib/dbus-1.0/dbus-daemon-launch-helper的权限

sudo chmod a+r dbus-daemon-launch-helper


总结:更多的灵活性以为着更多的责任,对于运行的任何命令都要非常情况它的效果,切记不能从网上随便粘贴一条命令然后以root权限运行,否则就是做死了:D

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
If the designated data directory "/home/test/mysql-8.0/data/" is unusable, you can remove all the files that the server added to it. However, please note that removing these files will delete all the data stored in the MySQL database. Make sure to backup any important data before proceeding with the following steps: 1. Stop the MySQL server: Use the appropriate command to stop the MySQL server. For example, you can use `sudo service mysql stop` or `sudo systemctl stop mysql` depending on your system. 2. Remove the data directory: Execute the following command to remove the data directory and its contents: ``` sudo rm -rf /home/test/mysql-8.0/data/ ``` Please be cautious when using the `rm` command with the `-rf` options, as it will recursively delete all files and directories without confirmation. 3. Recreate the data directory: After removing the data directory, you can recreate it using the following command: ``` sudo mkdir /home/test/mysql-8.0/data/ ``` 4. Set appropriate permissions: Ensure that the newly created data directory has the correct permissions for MySQL to access and modify it. You can set the necessary permissions using the following command: ``` sudo chown -R mysql:mysql /home/test/mysql-8.0/data/ sudo chmod -R 770 /home/test/mysql-8.0/data/ ``` These commands will change the ownership of the directory to the MySQL user and grant appropriate read, write, and execute permissions. 5. Start the MySQL server: Start the MySQL server using the appropriate command. For example, you can use `sudo service mysql start` or `sudo systemctl start mysql`. After completing these steps, the data directory should be recreated and ready for MySQL to use. However, keep in mind that all previous data will be lost.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值