Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Riemann Zeta

macrumors 6502a
Original poster
Feb 12, 2008
661
0
I did the JB protocol on my iPhone 3G, installed mobile terminal and all of the BSD layer, along with sudo. However, whenever I try to use a command with the form "sudo XXX -X" in terminal, I get an error. The system prompts for a password, to which I reply 'alpine' but then it fails, claiming that user "mobile" is not in the sudoers file. Comically, it then says that "this attempted illegal access incident will be reported" (I'm shaking in my boots of my iPhone logging my 'leet haX0ring skillz).

The paradox here is that in order to add a user name to /etc/sudoers, one must be able to edit the file with sudo (sudo nano /etc/sudoers), which gets us to a catch-22. What gives? I don't really feel like messing with SSH, so is there any way of getting sudo to work using the mobile terminal alone?
 
I may be wrong but I think the command you have to use on mobile terminal is

Code:
su

and then enter your password. "alpine" by default. that gives me sudo access when using mobile terminal.
 
You can think of sudo as a protection mechanism that allows you to run a single command as root while preventing you from staying logged in as root. There are two users on the iphone, "mobile" and "root". Both by default use alpine as password. If you want to use sudo, you will need to first log in as root , 'su -l root' and enter the default password, 'alpine'. You are now logged in as root and everything you do from now on will be as root. This can be bad especially if you walk away from your computer.

Now add the following to the /etc/sudoers file using your favorite text editor (vi, nano, etc).

'mobile ALL=(ALL) ALL'

Save the file and exit out of root. Now the account 'mobile' can use the sudo command like 'sudo rm -r /.' J/k, don't do this command! However, I would recommend changing your default passwords so that someone doesn't screw with you.
 
Thanks, adding mobile to sudoers with that syntax worked perfectly--I can now use sudo from mobile instead of having to always logoff then login as root. Killer tip man. Thankfully I know enough unix not to go borking things with sudo rm -r / ;).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.