Struggling with creating a ssh + password launcher
So I googled and found out that you can create aliases in .bashrc
to ensure you have a quick access to your ssh servers like so :
alias connectme='ssh root@192.168.1.12 -p 999'
that's quite nice I only have to type connectme
and the password. I googled some more and it turns out you can do this
alias connectme='sshpass -p "thepasswordincleartext" ssh root@192.168.1.12 -p 999'
(yes the second -p
is correctly passed as "port" not "password" to the second command; ssh )
I googled some more ans started creating a .desktop
launcher.
that's when I hit a road bump :
- either the passwordless version of that alias works but I have to type password everytime.
- or I add
sshpass
and the terminal window closes upon completion of the connection.
(I tried forcing terminal to stay open upon command completion in it's options, that's when I realised .desktop runners actually type out "exit" and force the disconnect)
here's what I'm working with :
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Exec=bash -c 'exec bash -i <<<"connectme"'
Name=connectme
Comment=connectme
Icon=/home/user/.local/share/icons/debian.png
this elaborate stupidity :
bash -c 'exec bash -i <<<"command"'
is done because for some reason Exec doesn't encompass the bash and your userspace realm. I haven't got a clue why not.
How do I set up a working launcher for ssh with bundled password (and why not a first command piped to the remote server upon connection)?
I'm willing to edit environement if that's what it takes.
command-line server bash ssh launcher
add a comment |
So I googled and found out that you can create aliases in .bashrc
to ensure you have a quick access to your ssh servers like so :
alias connectme='ssh root@192.168.1.12 -p 999'
that's quite nice I only have to type connectme
and the password. I googled some more and it turns out you can do this
alias connectme='sshpass -p "thepasswordincleartext" ssh root@192.168.1.12 -p 999'
(yes the second -p
is correctly passed as "port" not "password" to the second command; ssh )
I googled some more ans started creating a .desktop
launcher.
that's when I hit a road bump :
- either the passwordless version of that alias works but I have to type password everytime.
- or I add
sshpass
and the terminal window closes upon completion of the connection.
(I tried forcing terminal to stay open upon command completion in it's options, that's when I realised .desktop runners actually type out "exit" and force the disconnect)
here's what I'm working with :
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Exec=bash -c 'exec bash -i <<<"connectme"'
Name=connectme
Comment=connectme
Icon=/home/user/.local/share/icons/debian.png
this elaborate stupidity :
bash -c 'exec bash -i <<<"command"'
is done because for some reason Exec doesn't encompass the bash and your userspace realm. I haven't got a clue why not.
How do I set up a working launcher for ssh with bundled password (and why not a first command piped to the remote server upon connection)?
I'm willing to edit environement if that's what it takes.
command-line server bash ssh launcher
Instead of passing the password, I would recommend to use passwordless login. Not sure about the launcher, but I once answered a similar question that will allow you to dossh yourserver
that might be useful askubuntu.com/questions/1027428/…
– Katu
Mar 1 at 8:18
that's a pretty good solution, thanks! idealy I wouldn't have modified those servers but noone should notice. although the launcher still quits and it doesn't find "connectme" whereas in a regular terminal it does.
– tatsu
Mar 1 at 10:04
I think that any reasonable server admin would rather you add your public ssh key to it than have the password written in plain text in an uncontrolled machine. Just remember not to share your private key with anyone.
– Katu
Mar 1 at 11:07
ok. that still doesn't solve the launcher-terminal-closing issue, though.
– tatsu
Mar 1 at 12:06
add a comment |
So I googled and found out that you can create aliases in .bashrc
to ensure you have a quick access to your ssh servers like so :
alias connectme='ssh root@192.168.1.12 -p 999'
that's quite nice I only have to type connectme
and the password. I googled some more and it turns out you can do this
alias connectme='sshpass -p "thepasswordincleartext" ssh root@192.168.1.12 -p 999'
(yes the second -p
is correctly passed as "port" not "password" to the second command; ssh )
I googled some more ans started creating a .desktop
launcher.
that's when I hit a road bump :
- either the passwordless version of that alias works but I have to type password everytime.
- or I add
sshpass
and the terminal window closes upon completion of the connection.
(I tried forcing terminal to stay open upon command completion in it's options, that's when I realised .desktop runners actually type out "exit" and force the disconnect)
here's what I'm working with :
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Exec=bash -c 'exec bash -i <<<"connectme"'
Name=connectme
Comment=connectme
Icon=/home/user/.local/share/icons/debian.png
this elaborate stupidity :
bash -c 'exec bash -i <<<"command"'
is done because for some reason Exec doesn't encompass the bash and your userspace realm. I haven't got a clue why not.
How do I set up a working launcher for ssh with bundled password (and why not a first command piped to the remote server upon connection)?
I'm willing to edit environement if that's what it takes.
command-line server bash ssh launcher
So I googled and found out that you can create aliases in .bashrc
to ensure you have a quick access to your ssh servers like so :
alias connectme='ssh root@192.168.1.12 -p 999'
that's quite nice I only have to type connectme
and the password. I googled some more and it turns out you can do this
alias connectme='sshpass -p "thepasswordincleartext" ssh root@192.168.1.12 -p 999'
(yes the second -p
is correctly passed as "port" not "password" to the second command; ssh )
I googled some more ans started creating a .desktop
launcher.
that's when I hit a road bump :
- either the passwordless version of that alias works but I have to type password everytime.
- or I add
sshpass
and the terminal window closes upon completion of the connection.
(I tried forcing terminal to stay open upon command completion in it's options, that's when I realised .desktop runners actually type out "exit" and force the disconnect)
here's what I'm working with :
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Exec=bash -c 'exec bash -i <<<"connectme"'
Name=connectme
Comment=connectme
Icon=/home/user/.local/share/icons/debian.png
this elaborate stupidity :
bash -c 'exec bash -i <<<"command"'
is done because for some reason Exec doesn't encompass the bash and your userspace realm. I haven't got a clue why not.
How do I set up a working launcher for ssh with bundled password (and why not a first command piped to the remote server upon connection)?
I'm willing to edit environement if that's what it takes.
command-line server bash ssh launcher
command-line server bash ssh launcher
edited Mar 4 at 8:11
tatsu
asked Mar 1 at 8:05
tatsutatsu
534433
534433
Instead of passing the password, I would recommend to use passwordless login. Not sure about the launcher, but I once answered a similar question that will allow you to dossh yourserver
that might be useful askubuntu.com/questions/1027428/…
– Katu
Mar 1 at 8:18
that's a pretty good solution, thanks! idealy I wouldn't have modified those servers but noone should notice. although the launcher still quits and it doesn't find "connectme" whereas in a regular terminal it does.
– tatsu
Mar 1 at 10:04
I think that any reasonable server admin would rather you add your public ssh key to it than have the password written in plain text in an uncontrolled machine. Just remember not to share your private key with anyone.
– Katu
Mar 1 at 11:07
ok. that still doesn't solve the launcher-terminal-closing issue, though.
– tatsu
Mar 1 at 12:06
add a comment |
Instead of passing the password, I would recommend to use passwordless login. Not sure about the launcher, but I once answered a similar question that will allow you to dossh yourserver
that might be useful askubuntu.com/questions/1027428/…
– Katu
Mar 1 at 8:18
that's a pretty good solution, thanks! idealy I wouldn't have modified those servers but noone should notice. although the launcher still quits and it doesn't find "connectme" whereas in a regular terminal it does.
– tatsu
Mar 1 at 10:04
I think that any reasonable server admin would rather you add your public ssh key to it than have the password written in plain text in an uncontrolled machine. Just remember not to share your private key with anyone.
– Katu
Mar 1 at 11:07
ok. that still doesn't solve the launcher-terminal-closing issue, though.
– tatsu
Mar 1 at 12:06
Instead of passing the password, I would recommend to use passwordless login. Not sure about the launcher, but I once answered a similar question that will allow you to do
ssh yourserver
that might be useful askubuntu.com/questions/1027428/…– Katu
Mar 1 at 8:18
Instead of passing the password, I would recommend to use passwordless login. Not sure about the launcher, but I once answered a similar question that will allow you to do
ssh yourserver
that might be useful askubuntu.com/questions/1027428/…– Katu
Mar 1 at 8:18
that's a pretty good solution, thanks! idealy I wouldn't have modified those servers but noone should notice. although the launcher still quits and it doesn't find "connectme" whereas in a regular terminal it does.
– tatsu
Mar 1 at 10:04
that's a pretty good solution, thanks! idealy I wouldn't have modified those servers but noone should notice. although the launcher still quits and it doesn't find "connectme" whereas in a regular terminal it does.
– tatsu
Mar 1 at 10:04
I think that any reasonable server admin would rather you add your public ssh key to it than have the password written in plain text in an uncontrolled machine. Just remember not to share your private key with anyone.
– Katu
Mar 1 at 11:07
I think that any reasonable server admin would rather you add your public ssh key to it than have the password written in plain text in an uncontrolled machine. Just remember not to share your private key with anyone.
– Katu
Mar 1 at 11:07
ok. that still doesn't solve the launcher-terminal-closing issue, though.
– tatsu
Mar 1 at 12:06
ok. that still doesn't solve the launcher-terminal-closing issue, though.
– tatsu
Mar 1 at 12:06
add a comment |
1 Answer
1
active
oldest
votes
Rather than put paswords in your alias, use ssh-copy-id
to copy your PUBLIC ssh key to the target, and use ~/.ssh/config
to specify details. For an example, here's my ~/.ssh/config
:
$ cat .ssh/config
# alias aardvark='ssh -l w3 aardvark '
# alias cookie='ssh -l walt cookie '
# alias fw='ssh -l root -p 8022 spark2y '
# alias squid='ssh -l walt squid '
# alias wombat='ssh -l walt wombat '
#
Host aa
Hostname aardvark
User w3
ForwardX11 yes
Protocol 2
Host ck
Hostname cookie
User walt
ForwardX11 yes
Protocol 2
Host fw
Hostname spark2y
User root
Port 8022
ForwardX11 yes
Protocol 2
Host sq
Hostname squid
User walt
ForwardX11 yes
Protocol 2
Host wm
Hostname wombat
User walt
ForwardX11 yes
Protocol 2
Read man ssh-copy-id;man ssh;man ssh_config
.
well my end goal was to have launchers. I did the above and that's neat and all but I still can't get.desktop
files to work.
– tatsu
Mar 2 at 10:21
for me it doesn't work. it doesn't remeber password. dors this work with solaris?
– tatsu
Mar 4 at 8:16
add a comment |
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1122155%2fstruggling-with-creating-a-ssh-password-launcher%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Rather than put paswords in your alias, use ssh-copy-id
to copy your PUBLIC ssh key to the target, and use ~/.ssh/config
to specify details. For an example, here's my ~/.ssh/config
:
$ cat .ssh/config
# alias aardvark='ssh -l w3 aardvark '
# alias cookie='ssh -l walt cookie '
# alias fw='ssh -l root -p 8022 spark2y '
# alias squid='ssh -l walt squid '
# alias wombat='ssh -l walt wombat '
#
Host aa
Hostname aardvark
User w3
ForwardX11 yes
Protocol 2
Host ck
Hostname cookie
User walt
ForwardX11 yes
Protocol 2
Host fw
Hostname spark2y
User root
Port 8022
ForwardX11 yes
Protocol 2
Host sq
Hostname squid
User walt
ForwardX11 yes
Protocol 2
Host wm
Hostname wombat
User walt
ForwardX11 yes
Protocol 2
Read man ssh-copy-id;man ssh;man ssh_config
.
well my end goal was to have launchers. I did the above and that's neat and all but I still can't get.desktop
files to work.
– tatsu
Mar 2 at 10:21
for me it doesn't work. it doesn't remeber password. dors this work with solaris?
– tatsu
Mar 4 at 8:16
add a comment |
Rather than put paswords in your alias, use ssh-copy-id
to copy your PUBLIC ssh key to the target, and use ~/.ssh/config
to specify details. For an example, here's my ~/.ssh/config
:
$ cat .ssh/config
# alias aardvark='ssh -l w3 aardvark '
# alias cookie='ssh -l walt cookie '
# alias fw='ssh -l root -p 8022 spark2y '
# alias squid='ssh -l walt squid '
# alias wombat='ssh -l walt wombat '
#
Host aa
Hostname aardvark
User w3
ForwardX11 yes
Protocol 2
Host ck
Hostname cookie
User walt
ForwardX11 yes
Protocol 2
Host fw
Hostname spark2y
User root
Port 8022
ForwardX11 yes
Protocol 2
Host sq
Hostname squid
User walt
ForwardX11 yes
Protocol 2
Host wm
Hostname wombat
User walt
ForwardX11 yes
Protocol 2
Read man ssh-copy-id;man ssh;man ssh_config
.
well my end goal was to have launchers. I did the above and that's neat and all but I still can't get.desktop
files to work.
– tatsu
Mar 2 at 10:21
for me it doesn't work. it doesn't remeber password. dors this work with solaris?
– tatsu
Mar 4 at 8:16
add a comment |
Rather than put paswords in your alias, use ssh-copy-id
to copy your PUBLIC ssh key to the target, and use ~/.ssh/config
to specify details. For an example, here's my ~/.ssh/config
:
$ cat .ssh/config
# alias aardvark='ssh -l w3 aardvark '
# alias cookie='ssh -l walt cookie '
# alias fw='ssh -l root -p 8022 spark2y '
# alias squid='ssh -l walt squid '
# alias wombat='ssh -l walt wombat '
#
Host aa
Hostname aardvark
User w3
ForwardX11 yes
Protocol 2
Host ck
Hostname cookie
User walt
ForwardX11 yes
Protocol 2
Host fw
Hostname spark2y
User root
Port 8022
ForwardX11 yes
Protocol 2
Host sq
Hostname squid
User walt
ForwardX11 yes
Protocol 2
Host wm
Hostname wombat
User walt
ForwardX11 yes
Protocol 2
Read man ssh-copy-id;man ssh;man ssh_config
.
Rather than put paswords in your alias, use ssh-copy-id
to copy your PUBLIC ssh key to the target, and use ~/.ssh/config
to specify details. For an example, here's my ~/.ssh/config
:
$ cat .ssh/config
# alias aardvark='ssh -l w3 aardvark '
# alias cookie='ssh -l walt cookie '
# alias fw='ssh -l root -p 8022 spark2y '
# alias squid='ssh -l walt squid '
# alias wombat='ssh -l walt wombat '
#
Host aa
Hostname aardvark
User w3
ForwardX11 yes
Protocol 2
Host ck
Hostname cookie
User walt
ForwardX11 yes
Protocol 2
Host fw
Hostname spark2y
User root
Port 8022
ForwardX11 yes
Protocol 2
Host sq
Hostname squid
User walt
ForwardX11 yes
Protocol 2
Host wm
Hostname wombat
User walt
ForwardX11 yes
Protocol 2
Read man ssh-copy-id;man ssh;man ssh_config
.
answered Mar 1 at 14:48
waltinatorwaltinator
22.9k74169
22.9k74169
well my end goal was to have launchers. I did the above and that's neat and all but I still can't get.desktop
files to work.
– tatsu
Mar 2 at 10:21
for me it doesn't work. it doesn't remeber password. dors this work with solaris?
– tatsu
Mar 4 at 8:16
add a comment |
well my end goal was to have launchers. I did the above and that's neat and all but I still can't get.desktop
files to work.
– tatsu
Mar 2 at 10:21
for me it doesn't work. it doesn't remeber password. dors this work with solaris?
– tatsu
Mar 4 at 8:16
well my end goal was to have launchers. I did the above and that's neat and all but I still can't get
.desktop
files to work.– tatsu
Mar 2 at 10:21
well my end goal was to have launchers. I did the above and that's neat and all but I still can't get
.desktop
files to work.– tatsu
Mar 2 at 10:21
for me it doesn't work. it doesn't remeber password. dors this work with solaris?
– tatsu
Mar 4 at 8:16
for me it doesn't work. it doesn't remeber password. dors this work with solaris?
– tatsu
Mar 4 at 8:16
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1122155%2fstruggling-with-creating-a-ssh-password-launcher%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Instead of passing the password, I would recommend to use passwordless login. Not sure about the launcher, but I once answered a similar question that will allow you to do
ssh yourserver
that might be useful askubuntu.com/questions/1027428/…– Katu
Mar 1 at 8:18
that's a pretty good solution, thanks! idealy I wouldn't have modified those servers but noone should notice. although the launcher still quits and it doesn't find "connectme" whereas in a regular terminal it does.
– tatsu
Mar 1 at 10:04
I think that any reasonable server admin would rather you add your public ssh key to it than have the password written in plain text in an uncontrolled machine. Just remember not to share your private key with anyone.
– Katu
Mar 1 at 11:07
ok. that still doesn't solve the launcher-terminal-closing issue, though.
– tatsu
Mar 1 at 12:06