特殊:Badtitle/NS100:Iphone passwordless access
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/iphone%20passwordless%20access }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/af | • {{#if: UbuntuHelp:iphone%20passwordless%20access|Afrikaans| [[::Iphone passwordless access/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/ar | • {{#if: UbuntuHelp:iphone%20passwordless%20access|العربية| [[::Iphone passwordless access/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/az | • {{#if: UbuntuHelp:iphone%20passwordless%20access|azərbaycanca| [[::Iphone passwordless access/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/bcc | • {{#if: UbuntuHelp:iphone%20passwordless%20access|جهلسری بلوچی| [[::Iphone passwordless access/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/bg | • {{#if: UbuntuHelp:iphone%20passwordless%20access|български| [[::Iphone passwordless access/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/br | • {{#if: UbuntuHelp:iphone%20passwordless%20access|brezhoneg| [[::Iphone passwordless access/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/ca | • {{#if: UbuntuHelp:iphone%20passwordless%20access|català| [[::Iphone passwordless access/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/cs | • {{#if: UbuntuHelp:iphone%20passwordless%20access|čeština| [[::Iphone passwordless access/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/de | • {{#if: UbuntuHelp:iphone%20passwordless%20access|Deutsch| [[::Iphone passwordless access/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/el | • {{#if: UbuntuHelp:iphone%20passwordless%20access|Ελληνικά| [[::Iphone passwordless access/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/es | • {{#if: UbuntuHelp:iphone%20passwordless%20access|español| [[::Iphone passwordless access/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/fa | • {{#if: UbuntuHelp:iphone%20passwordless%20access|فارسی| [[::Iphone passwordless access/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/fi | • {{#if: UbuntuHelp:iphone%20passwordless%20access|suomi| [[::Iphone passwordless access/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/fr | • {{#if: UbuntuHelp:iphone%20passwordless%20access|français| [[::Iphone passwordless access/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/gu | • {{#if: UbuntuHelp:iphone%20passwordless%20access|ગુજરાતી| [[::Iphone passwordless access/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/he | • {{#if: UbuntuHelp:iphone%20passwordless%20access|עברית| [[::Iphone passwordless access/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/hu | • {{#if: UbuntuHelp:iphone%20passwordless%20access|magyar| [[::Iphone passwordless access/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/id | • {{#if: UbuntuHelp:iphone%20passwordless%20access|Bahasa Indonesia| [[::Iphone passwordless access/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/it | • {{#if: UbuntuHelp:iphone%20passwordless%20access|italiano| [[::Iphone passwordless access/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/ja | • {{#if: UbuntuHelp:iphone%20passwordless%20access|日本語| [[::Iphone passwordless access/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/ko | • {{#if: UbuntuHelp:iphone%20passwordless%20access|한국어| [[::Iphone passwordless access/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/ksh | • {{#if: UbuntuHelp:iphone%20passwordless%20access|Ripoarisch| [[::Iphone passwordless access/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/mr | • {{#if: UbuntuHelp:iphone%20passwordless%20access|मराठी| [[::Iphone passwordless access/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/ms | • {{#if: UbuntuHelp:iphone%20passwordless%20access|Bahasa Melayu| [[::Iphone passwordless access/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/nl | • {{#if: UbuntuHelp:iphone%20passwordless%20access|Nederlands| [[::Iphone passwordless access/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/no | • {{#if: UbuntuHelp:iphone%20passwordless%20access|norsk| [[::Iphone passwordless access/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/oc | • {{#if: UbuntuHelp:iphone%20passwordless%20access|occitan| [[::Iphone passwordless access/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/pl | • {{#if: UbuntuHelp:iphone%20passwordless%20access|polski| [[::Iphone passwordless access/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/pt | • {{#if: UbuntuHelp:iphone%20passwordless%20access|português| [[::Iphone passwordless access/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/ro | • {{#if: UbuntuHelp:iphone%20passwordless%20access|română| [[::Iphone passwordless access/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/ru | • {{#if: UbuntuHelp:iphone%20passwordless%20access|русский| [[::Iphone passwordless access/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/si | • {{#if: UbuntuHelp:iphone%20passwordless%20access|සිංහල| [[::Iphone passwordless access/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/sq | • {{#if: UbuntuHelp:iphone%20passwordless%20access|shqip| [[::Iphone passwordless access/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/sr | • {{#if: UbuntuHelp:iphone%20passwordless%20access|српски / srpski| [[::Iphone passwordless access/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/sv | • {{#if: UbuntuHelp:iphone%20passwordless%20access|svenska| [[::Iphone passwordless access/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/th | • {{#if: UbuntuHelp:iphone%20passwordless%20access|ไทย| [[::Iphone passwordless access/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/tr | • {{#if: UbuntuHelp:iphone%20passwordless%20access|Türkçe| [[::Iphone passwordless access/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/vi | • {{#if: UbuntuHelp:iphone%20passwordless%20access|Tiếng Việt| [[::Iphone passwordless access/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/yue | • {{#if: UbuntuHelp:iphone%20passwordless%20access|粵語| [[::Iphone passwordless access/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/zh | • {{#if: UbuntuHelp:iphone%20passwordless%20access|中文| [[::Iphone passwordless access/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/zh-hans | • {{#if: UbuntuHelp:iphone%20passwordless%20access|中文(简体)| [[::Iphone passwordless access/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:iphone%20passwordless%20access | UbuntuHelp:iphone%20passwordless%20access | {{#if: | :}}Iphone passwordless access}}/zh-hant | • {{#if: UbuntuHelp:iphone%20passwordless%20access|中文(繁體)| [[::Iphone passwordless access/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:iphone%20passwordless%20access|:Iphone passwordless access|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :Iphone passwordless access/zh | | {{#ifexist: Iphone passwordless access/zh | | {{#ifeq: {{#titleparts:Iphone passwordless access|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Iphone passwordless access|1|-1|}} | zh | | }}
Passwordless Access
In order for programs like Amarok to connect to your iPhone via SSH without asking for a password, you can set up key based logins. You can skip this step if you're happy mounting it manually from a terminal, typing your password each time.
- Make a private and a public key. We'll specify a different identity than the default, so it won't conflict with any existing keys you have. Run the following command in a terminal:
$ ssh-keygen -t rsa -f ~/.ssh/iphone_identity -N ""
This will create a directory called .ssh in your home directory, and place three files in there: iphone_identity, iphone_identity.pub, and known_hosts. iphone_identy is your private keyfile, and iphone_identity.pub is your public one. You want your device to have the public key so you can authenticate towards it with your private one.
- Install your public key to the device. If it asks if you want to accept the untrusted device as a trusted host, do so.
$ ssh-copy-id -i ~/.ssh/iphone_identity.pub root@<device ip>
- Log into your iPhone again.
$ ssh root@<device ip>
If it at this point asks for your password, that means the server installed on the device has not yet been configured to accept keys as a method of authorization. Ergo, you are not using "Ste's OpenSSH package", which will be mentioned later in this wiki. For the time being, the default password for 1.1.0 phones is 'dottie', and 'alpine' for 1.1.1 and 1.1.2 phones.
- Change the password. This is important for security. You will eventually be logging in via your key anyway, but make it something you'll remember.
$ passwd
- NOTE: On firmware 1.1.3, BSD Subsystem maintainers highly recommend against using the "passwd" command until a stability bug is fixed. Until then, you can use this command, and replace the output password hashes for the users 'root' and 'mobile' in /etc/master.passwd on your device.
$ perl -e 'print crypt("yourpasswordhere", "/s");'
The following steps do NOT apply to Ste's OpenSSH package, which is probably the most common one now. In order to get passwordless login working with Ste's package, rename your ~/.ssh/authorized_keys file on your device to ~/.ssh/authorized_keys2 and proceed straight to adjusting the permissions as described below ("if all else fails"). Full instructions can be found here: [1] If you are not using said package on your device, follow these instructions to enable the public key authorization method.
- Edit /etc/sshd_config (/etc/ssh/sshd_config on iPhone OS 3.0):
$ pico /etc/sshd_config
- Scroll down to the segment beginning with '#RSAAuthentication', and set it up as follows:
RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys
Remove any commenting hashmarks (#) prepended to the beginning of these three lines.
- Hit Ctrl+X to exit, and save your changes.
- At this point you should be finished. Reboot your device.
$ reboot
- Give it some time to start up, then try logging back in. This time, it should automatically authenticate using your private key.
$ ssh -i ~/.ssh/iphone_identity root@<device ip>
- To make the process even simpler, add these lines to your ~/.ssh/config file on your computer.
Host iphone HostName <device ip> User root IdentityFile ~/.ssh/iphone_identity
Now you should be able to login with this simple command:
$ ssh iphone
If all else fails
If you're still asked for a password:
- Check your local ~/.ssh/iphone_identity.pub file and compare it with the ~/.ssh/authenticated_keys file on your device. Does any entry match? If not, try the ssh-copy-id command again. Alternatively, just copy the contents of your iphone_identity.pub file and paste it on a line of its own in authenticated_keys. Entries must be one line only.
- Did you properly input and save the changes to /etc/sshd_conf?
- Did you reboot the device after changing /etc/sshd_conf?
- If you used a tool other than ssh-copy-id, check the permissions for your SSH files. If you type the following command, it should look like this:
# ls -al ~/.ssh total 4 drwxr-xr-x 2 root wheel 102 Nov 21 04:25 . drwxr-xr-x 6 root wheel 306 Nov 20 00:02 .. -rw-r--r-- 1 root wheel 395 Nov 20 03:01 authorized_keys
- Try resetting the permissions on the iPod or iPhone's SSH files manually:
chmod 755 /var/root chmod 700 /var/root/.ssh chmod 644 /var/root/.ssh/authorized_keys
- For more debugging, you can get verbose output from ssh:
$ ssh -vvv iphone
- You can also turn on syslog on the device to have it log any error messages that the SSH server might output.
$ ssh iphone Password: $ echo "*.* /var/log/syslog" > /etc/syslog.conf $ killall syslogd $ /usr/sbin/syslogd -bsd_out 1 $ tail -f /var/log/syslog