Tag Archives: macosx

小小的黑一把MacOSX–修改root密码

如果你和我一样经常需要在命令行里sudo,应该知道sudo的痛苦。。特别是密码比较长的时候,如果可以直接以root权限登陆terminal,一切限制都不存在鸟~另外还可以用root权限登陆到图形界面- –
方案1:修改root密码
sudo passwd,回车后输入两次想要给root的密码,done……
表打我。。
想要root的shell时候直接su,给密码,完事,exit返回正常

Mac:~ john$ sudo passwd
Password:
Changing password for root.
New password:
Retype new password:
Mac:~ john$ whoami
cxlyx
Mac:~ john$ su
Password:
sh-3.2# whoami
root

方案2:不修改root密码
需要root权限的terminal时候,sudo bash,回车,给自己当前用户密码,完事……唯一缺点就是不能启动root权限的图形界面

repair apple hfs file system with fsck_hfs

To be simple:

When you can’t boot into MacOSX in your mac computer, just Press and hold Apple key + s on you keyboard when powering on, you will get into a text based shell, there we can do some fix without use of Mac install CD.

First, we should know which disk need to run fsck_hfs.

Hint “fsck” and press enter, you will get a error message like:

fsck can’t run on /dev/rdisk0s2

The /dev/rdisk0s2 above is what we need for the following step, if you are installing macosx as default layout, it should be /dev/rdisk0s2

Ok, let’s roll.

Type command: fsck_hfs -fy /dev/rdisk0s2 and hint enter, after a few minutes, it should stop running, end with ***disk modified***

Then you should issue “reboot” command to reboot your mac, if it still doesn’t work, try the following:

fsck_hfs -fry /dev/rdisk0s2

Apple kb link here: http://developer.apple.com/library/mac/#DOCUMENTATION/Darwin/Reference/ManPages/man8/fsck_hfs.8.html

Good luck to you guys.

Following content is off topic and in Chinese, just ignore them if you r trying to fix your mac 😉

这篇文章本来不打算恢复的,某然间去Google WMT看到这篇文章有不少链,都来自apple的论坛,就这样404掉好像不太妥,于是手工凭印象恢复了……估计很快就能看到大量(~10ip/day)的访问了。。