2

I have a Ubuntu server with LXDE for development, now how would I create a .desktop file to start a session that doesn't startx but actually logs me into a regular tty1 session and also runs a particular script?

1 Answer 1

1

It is not completely clear for me if you want to log to that server from a different computer, and where is the script that you want to execute.

However it is, you can execute a script via ssh. Let we see it in 2 steps.

Step 1: Start by command line.

If it is a local script you can do something similar to

 ssh me@MyServer '/bin/bash -s' < /path/to/local_script.sh

if it is a remote script you can do something similar to

 ssh me@MyServer "/bin/bash /path/to/remote_script.sh"

If the computer from which you want to run the script is the server itself you can substitute MyServer with localhost.

Step 2 do the .desktop file.

Create a ~/Desktop/MyDesktopShort.desktop file, and write inside something similar to this

[Desktop Entry]
Version=1.0
Exec=/path/to/local_script.sh
Name=Let We Run it
GenericName=SSH Server
Comment=Execute on Server my script
Encoding=UTF-8
Terminal=true
Type=Application
Categories=Application;Network;

If the script is on the remote machine write the ssh command that you have checked before via command line.

For more information check here about .desktop syntax or even here.

The Exec part is where you can write what you want to execute.
I cannot help you to connect specifically with tty1, but via ssh you will be connected with the first tty available.
Final Notes:

  • you need sshd running on the server machine.
  • always better /bin/bash than a simply bash to avoid eventual trojan horses attacks.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .