http://cheese.androidlive.club
http://cheese.androidlive.club

Subscribe to RSS

If needed you can run SSH commands followed by immediately and then exit so it will not maintain a connection with the remote server. To install parallel-ssh, you need to first install PIP on your Linux system. It employs a sliding window of threads to execute remote commands. When you run ssh user@cheese.androidlive.club -t "command1;command2" . on the remote host) will run commands in ~/.ssh/rc upon connection.

Your Answerssh run command on remote server Вам посетитьlinux - Execute a remote script on a remote computer via SSH - Super User

This goes back to the basic behavior of any shell. When you login simply as ssh user server. When you run ssh user some. The first one lets you run whatever you put into the stdin while sourcing the dot files, while second just executes those commands and exits.

Essentially, there is no way to run a command before interactive use unless it is in one of the dot files or get an interactive shell from the single-shot command sh -c or whichever shell it may be, not necessarily sh. My first idea I had is this : if the shell uses server's local.

Not unless you copy the dot file over to remote server with scp or rsync. Problem is this variable has to be exported to the remote server, and Gilles answer helped me to do something like this:. So by now we can see that ssh user server -t 'command1;shell' pattern works the best. I just created this file, and added who there, and now a list of users is displayed every time I make a remote connection, and I still get a login shell.

Just for completeness, if you can edit your own. Ubuntu Community Ask! Home Questions Tags Users Unanswered. Michael Hoffmann Michael Hoffmann 2, 5 5 gold badges 12 12 silver badges 24 24 bronze badges. Possible duplicate of How to keep processes running after ending ssh session? This question is related to, but definitely not a duplicate of that question.

I'm asking how to run who automatically upon connection without closing the connection; not how to leave it running after disconnection. That would be useless in this situation, where I just want to see some output every time I connect remotely, without having to type it every time. Is your goal to keep session alive to run more commands , or just hold session to view output of one command that runs long time?

In first case, if server is crowded , you can log out right away and try different one, but if not crowded, continue working. I want to hold the session open to run more commands. Just passing who with ssh shows the output, but kills the session. I see. So basically an init command is what you want. Why this works the way it does This goes back to the basic behavior of any shell.

Failed or incomplete ideas My first idea I had is this : if the shell uses server's local. Sergiy Kolodyazhnyy Sergiy Kolodyazhnyy I chose this as the answer, because 1 it improves on the other answers if only slightly , and 2 it explains why it works, which is always more helpful than just a line of code or a what. I can't award the bounty until later today, but this answer has earned it.

As another example, I use a ton of machines at work that often require me to use a shared account to have rights to do certain things yeah I know: bad idea but don't blame me, I didn't set things up that way , and they usually have ksh as the default shell. I'd like to log in, switch to bash or zsh , and source my own account's.

This would be easy if I could establish an interactive ssh session and pass a command to the remote machine to run upon login. I have a very kludgey and untested solution in mind that I will post, but I'm hoping someone knows a better way. UPDATE: for those who didn't realize this, I'm not planning to do all this by hand, so telling me to open an interactive session and then do it by hand doesn't actually solve anything.

Here I use -t to force the allocation of a pseudo-terminal, which is required for an interactive shell. Then I execute two commands on the server: first the thing I wanted to do prior to opening the interactive shell in my case, changing directory to a specific folder , and then the interactive shell itself.

The single quotes ensure the entire thing is passed to the remote server as the command to be run by your default shell. Thanks again to dogbane for providing the necessary clue with -t. I used to solve this problem with expect , which is definitely killing a mouse with a cannon. The login is interactive and your command is passed as if you typed it on the interactive command line.

The session terminates as if you had typed. Unfortunately, you're not likely to like the way that works, 'cause "cat" buffers the lines it writes to stdout If we create a script called "echo-cat" that looks something like this:.

Create a script named e. This script should first save the quoted command without quotes in file named e. If running ssh user example. For this to work, the remote machine must source. After running. Home Questions Tags Users Unanswered. With ssh, how can you run a command on the remote machine without exiting? Ask Question. Normally, if you pass a command to ssh like so ssh me example.

For instance, I'd like to be able to open screen and restart a specific screen session: ssh me example. Did you miss the "without exiting" part of the question? I'm quite sure this will exit after the command finishes. The -t switch fixes the questioner's problem with screen as well. Can this be used with arbitrary commands, without closing the connection?

If I try ssh -t www. Mad Physicist 2, 1 1 gold badge 10 10 silver badges 13 13 bronze badges. Try this solution. Gilles If the session terminates after the command is complete, then this does not answer the question.

By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. I connect to my school's Linux Lab frequently to work on my programming assignments remotely.

←back | forward →
Menu
  • car sales australia used
  • groin injury pain
  • sore soleus
  • mind healing quotes
  • health food restaurants near me
  • online racing games for kids
  • world bodybuilder image
  • how to speed read people
  • most played mobile games 2015
  • monk meditation techniques
  • RSS
  • SITEMAP
  • more
    868 869 870 871 872