president
president

Reputation: 523

How to execute command with bash script inside Ubuntu, which was started with bash script?

How to execute command with bash script inside Ubuntu, which was started with bash script?

for example with ssh I'm accessing ubuntu. How to run command inside opened ubuntu. If I write it in bash script after ssh command it will get executed as soon as I exit out of this environment.

How to execute bash script inside this environment?

Upvotes: 0

Views: 126

Answers (3)

7 Reeds
7 Reeds

Reputation: 2559

Is it possible that you are asking how to start a command on a remote machine with ssh? That would be:

ssh user@hostname your_script_name-here

There are some command line args that affect the remote command, like -f. If this is indeed what you are asking about then the ssh man page is mostly your friend.

Upvotes: 1

Wurtzelbert
Wurtzelbert

Reputation: 41

I don't really understand what you want to do. Do you want to bash a script for example ./main.py so that the script doesn't stop when you leave the SSH-connection? If that's your question, try ./main.py & !

Upvotes: 0

Harisudhan. A
Harisudhan. A

Reputation: 672

Yes it is very much easy,

   you need to install Secure Shell (SSH) / Secure FTP (SFTP) Server in Ubuntu. then go through the recommended level of security settings to run an SSH server to be able to execute terminal commands or transfer files securely.

for reference check out the example video and this tutorial as well.

Upvotes: 1

Related Questions