Thursday, April 25, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 3155  / 1 Year ago, tue, january 3, 2023, 4:53:58

In windows we have created a batch file to login into a machine via putty. On clicking the batch file it logins into that machine. Is it possible to create a script in ubuntu to do the same task?


More From » login

 Answers
7

Create a launcher server.desktop with the following content:



[Desktop Entry]
Name=Server Name
Exec=ssh [email protected]
Terminal=true
Type=Application


and give it execution permissions.



Obviously you should put the real user and the real server.domain.com in the Exec= line.



To allow to choose the username, substitute the Exec= line with the following:



Exec=sh -c 'user=$(zenity --entry --title="Set username" --text="Username: " --entry-text="$USER"); if [ -n "$user" ]; then ssh [email protected]; else exit; fi'

[#44899] Wednesday, January 4, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
moloy

Total Points: 457
Total Questions: 93
Total Answers: 119

Location: Romania
Member since Wed, Dec 29, 2021
2 Years ago
;