Community discussions

MikroTik App
 
muhanadali
newbie
Topic Author
Posts: 49
Joined: Tue Aug 25, 2020 12:24 pm

Password for ssh

Wed Jan 05, 2022 2:31 am

:system ssh-exec user=remote address=<IP> command="{<cmds>}"

why i can't use password ?

Is it reasonable to leave the device without a password just because I need this feature ?
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3297
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Password for ssh

Wed Jan 05, 2022 6:35 am

Password is a must and on newer RouterOS you are forced to set password. No password, no security.
 
User avatar
vecernik87
Forum Veteran
Forum Veteran
Posts: 882
Joined: Fri Nov 10, 2017 8:19 am

Re: Password for ssh

Wed Jan 05, 2022 11:10 am

@jotne: I think OP talks about no password parameter in the ssh-exec command.

@muhanadali: It is not possible to hardcode the password into your script and I would strongly advice against leaving your router without password. If you want to use ssh-exec with some script (i.e. you can't interactively type in the password) then you need to set SSH keys: SSH private key in source router (which is creating the ssh connection) and SSH public key in destination router (which is receiving the ssh connection). You can create the SSH key pair in puttygen or openssl or any other SSH key-pair generator.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3297
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Password for ssh

Wed Jan 05, 2022 8:05 pm

I think he was talking about not put a password on the remote router, and then use the script without password.
Not recommended.
 
muhanadali
newbie
Topic Author
Posts: 49
Joined: Tue Aug 25, 2020 12:24 pm

Re: Password for ssh

Wed Jan 05, 2022 9:45 pm

I think he was talking about not put a password on the remote router, and then use the script without password.
Not recommended.
yes that's what i mean
 
muhanadali
newbie
Topic Author
Posts: 49
Joined: Tue Aug 25, 2020 12:24 pm

Re: Password for ssh

Wed Jan 05, 2022 9:47 pm

@jotne: I think OP talks about no password parameter in the ssh-exec command.

@muhanadali: It is not possible to hardcode the password into your script and I would strongly advice against leaving your router without password. If you want to use ssh-exec with some script (i.e. you can't interactively type in the password) then you need to set SSH keys: SSH private key in source router (which is creating the ssh connection) and SSH public key in destination router (which is receiving the ssh connection). You can create the SSH key pair in puttygen or openssl or any other SSH key-pair generator.
Can you give me an example for ssh key and how to work ?

i need the ssh-exec in my Router But i can't leave the remoter router without password
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3297
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Password for ssh  [SOLVED]

Thu Jan 06, 2022 6:04 am

Who is online

Users browsing this forum: No registered users and 30 guests