Google
 
Web www.howardforums.com
Pages: 1

Changing SSH password?

(Click here to view the original thread with full colors/images)


Posted by: RLP06

Anyone know how to change the root/dottie password, my concern is someone logging into my iphone when i'm on public domains...



Posted by: PDR447

you can on a mac via independence.



Posted by: deepinya

...and on windows?



Posted by: PDR447

sorry, I'm a mac guy. havn't touched windows in years... maybe search around on here or hackintosh.



Posted by: NetNet

Quote:
Originally Posted by deepinya
...and on windows?


Depending on what you have installed already on your iphone, there are several possible "ways to skin a cat" (poor little cat, I feel sorry for the creature;-), I mean, to change the root's password (from Windows).

1). If you have /usr/bin/passwd executable on your iPhone (I have), you could try to ssh from Windows to your iPhone, go to /usr/bin, and do
./passwd
It should prompt you for the password to enter. This is a regular BSD UNIX way. If Apple (or whoever else) didn't change the original UNIX code, this should work. I didn't try it on iPhone, though. I used "the most difficult way" (see below).

2). The passwords are stored on iPhone in a hashed form in
/private/etc/master.passwd

Download it from iPhone to your Windows, and make a backup. Using one of the methods below, make a hash of your new root's password, update the master.passwd file with this new hash and upload it to your iPhone.

Now how to hash your password:
a). (Easy way): go to http://iphone.simbunch.com/crypt.php
enter a password of your choice, and the site will give you the new
contents of your master.passwd file. Actually, when I tried them, they only changed the root's password (in one place), so, when comparing with your backup, you'll immediately find the place where the update is needed.

b). (My way = difficult way:-) Since this is my security, and I don't trust anyone, including that simbunch site (sorry guys;-), I decided to digg a little, and to hash it myself. Just by using Google, I found all the tools and info.

First, from http://www.modmyiphone.com/forums/showthread.php?t=1865

scroll down and you can see this is the procedure to change the password:

Quote:
Originally Posted by cybergreg
Change the root password

If you don't like 'dottie', you can generate a new encrypted password by running:

perl -e 'print crypt("MYPASSWORD", "XU");'

Where MYPASSWORD is the new password you want, and XU is a random two-letter salt. Copy the encrypted output and replace the existing one in /etc/master.passwd on the phone.
Un-quote.

Second, I Google'd, downloaded and installed on my XP ActivePerl by ActiveState (the file name is ActivePerl-5.8.8.822-MSWin32-x86-280952.msi)
It installed itself in C:\Perl\

Third, I Google'd and found at http://www.pixelchaos.net/index.php/archives/18
a crypt.pl script:

#!/usr/bin/perl
#
($NAME=$0) =~ s#.*/##; # get basename from $0
$salt="00";
if (@ARGV==2) { $salt=pop(@ARGV); }
else
{
print "salt to use: ";
chomp($salt=<&gt; );
}
if (@ARGV==1) { $string=pop(@ARGV); }
else
{
print "Input-String to crypt: ";
chomp($string=<&gt; );
}
$out=crypt($string, $salt);
print "The crypt of [$string] with salt [$salt] is [$out]\n";

Then, I saved using Notepad this crypt.pl file into C:\Perl\lib\

Then, I updated using Notepad the first line in this crypt.pl file in C:\Perl\lib\
Replacing

#!/usr/bin/perl

with just

#

(I just didn't want to confuse the ActivePerl with this route, which, apparently doesn't exist on my XP;-)

Then, after playing for some time with perl -e ..., with single-quotes and double-quotes (apparently on XP all is different from Unix;-), I found a working way to call this script on XP: go to C:\Perl\lib>, and then:

perl -e "print crypt("dottie","XU");"

and

perl -e "print crypt("alpine",'/s');"

Please pay attention, that instead of original single-quotes I used double-quotes, and in the case of /s "salt" - instead of double quotes I used single-quotes. Only these combinations gave me exactly same hashes, as in the original master.passwd file. Otherwise I was getting different error messages. Apparently, even when using Perl, single-quotes and double-quotes on XP work quite different way from what they do on Unix.

After verifying that these tools work, just select your new root's password, and you'll get a new hash. There were reports, that uppercase letters and numbers do not work on iPhone. I didn't try, and can't confirm. Also, there were publications, that only the first 8 characters (including the two-character "salt") are actually used by those hashing functions on Unix, so 6 character lengths for both "dottie" and "alpine" are not a surprise for me. A surprise is that Apple selected two dictionary words, making very weak passwords.

I used WinSCP to both download master.passwd file from iPhone, rename the old one on iPhone, and upload the updated one to iPhone. Use your favorite tool(s) for this.

Sounds complicated, but actually it's not. I had fun doing this.

Happy changing your iPhone's root's password on your Windows!

Check out my thread "Tethering iPhone with $5.99 T-Mobile Web - Works!"
in this subforum (I did it from Windows;-).

NetNet



Posted by: yozh

just ssh in to the phone and type passwd it will work just like that. Works like a charm or on the iphone install terminal and type it in there.



Posted by: deepinya

NetNet I appreciate the instructions but I have no clue what half that means LOL!

Yozh's solution sounds easier for noobs like me. You talking about Mobile Terminal under community sources?



Posted by: yozh

Quote:
Originally Posted by deepinya
NetNet I appreciate the instructions but I have no clue what half that means LOL!

Yozh's solution sounds easier for noobs like me. You talking about Mobile Terminal under community sources?

yep or term-vt100 eather or will work as long as you have BSD subsystem installed. Which you should anyway if SSH is therel.



Posted by: deepinya

So I install BSD then mobile terminal? Then what? lol



Posted by: yozh

Quote:
Originally Posted by deepinya
So I install BSD then mobile terminal? Then what? lol

then go to the terminal and type passwd and it will ask you for the new password twice and thats it.



Posted by: klillevo

With the 'services' app, you can disable SSH, which should both save battery power, and prevent anyone from logging in..



Posted by: deepinya

any drawbacks to disabling ssh?



Posted by: RLP06

Quote:
Originally Posted by deepinya
any drawbacks to disabling ssh?


no, from what you're asking, you probably don't know what its used for, so you're not gaining anything from it



Posted by: deepinya

Thanks for the help guys!





vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
vB Easy Archive Final ©2000 - 2008 - Created by Stefan "Xenon" Kaeser