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

MacBH928

macrumors G3
Original poster
May 17, 2008
9,007
4,095
Hello,
I have a raspberry pi that I ssh into via terminal. How do I create a shortcut with saved password and user name in it. Just double click it and it auto login. I know you can do this with a file that ends with ".command" I just don't know what to write in the file. I also assume I have to add in the port number which I do not know.
 
Not sure about a shortcut, but there are ways to automate command line steps. I have used both in the past.

One way is using AppleScript, but it takes some time to write the script. I have done this, but it took hours to get everything right. Fun to tinker with, but not very productive.

Another way is to create an SSH key on your machine using "ssh-keygen -t rsa", copy it into the ~.ssh/authorized_keys on the remote machine using "ssh-copy-id -I .ssh/authorized_keys user@machine". Also, add an entry in ~/ssh/ssh_config on your Mac to simplify the command line script. This looks something like:

Host foo
HostName 192.168.1.20
User root
IdentityFile ~/.ssh/id_rsa.pub

Then, when ready to use it, open Terminal, type "ssh foo" and you are in.

The second method requires the ssh copy-id script which Apple leaves out on the Mac distribution of scripts. It can be added with Homebrew or Mac Ports. More on the topic here.

Either way, you are spending a good amount of time setting things up, but eventually save time and effort each time you connect.
 
When you login to mount drag to mount to right ride of your dock! So in the future just click the shortcut, put in your password and save in it in your Keychain! So it will mount auto next time!
 
Not sure about a shortcut, but there are ways to automate command line steps. I have used both in the past.

One way is using AppleScript, but it takes some time to write the script. I have done this, but it took hours to get everything right. Fun to tinker with, but not very productive.

Another way is to create an SSH key on your machine using "ssh-keygen -t rsa", copy it into the ~.ssh/authorized_keys on the remote machine using "ssh-copy-id -I .ssh/authorized_keys user@machine". Also, add an entry in ~/ssh/ssh_config on your Mac to simplify the command line script. This looks something like:

Host foo
HostName 192.168.1.20
User root
IdentityFile ~/.ssh/id_rsa.pub

Then, when ready to use it, open Terminal, type "ssh foo" and you are in.

The second method requires the ssh copy-id script which Apple leaves out on the Mac distribution of scripts. It can be added with Homebrew or Mac Ports. More on the topic here.

Either way, you are spending a good amount of time setting things up, but eventually save time and effort each time you connect.

I will further investigate this , thanks

When you login to mount drag to mount to right ride of your dock! So in the future just click the shortcut, put in your password and save in it in your Keychain! So it will mount auto next time!

I don't understand what you are saying, login to mount? drag to mount?
I login in via terminal app using: ssh username@server
 
When a remote mount is connected and shown on desktop one can drag that mounted share and drag it to right side of the Dock! Unless you don’t mount shares what do do with them?
 
When a remote mount is connected and shown on desktop one can drag that mounted share and drag it to right side of the Dock! Unless you don’t mount shares what do do with them?
SSH is generally not used to mount volumes. Your suggestion makes no sense.
 
  • Like
Reactions: Scary Spice
what I was telling that if a person drags share to right side of the Dock will make shortcut to mount that share automatically. So you want to ssh manually every single time?
Again, SSH is not always used for file sharing and even when it is, it’s not done in the manner of regular file sharing. There’s nothing to drag to the dock because no volume is mounted when using the “ssh username@server” command in Terminal.
 
  • Like
Reactions: Scary Spice
Had to do this exact thing years ago. I didn't use any 3rd party tools, was all from the terminal like this:

 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.