« first day (4926 days earlier)      last day (107 days later) » 

3:34 PM
Hi @tom
So, if you want an interactive shell session, why don't you just run ssh with no commands?
tom
tom
3:56 PM
:65457300
Hi thank you for your time. Because it is unproductive to type commands in an interactive shell after SSH log in.
Managing 10 or more different servers and executing 10 different script every single time after you SSH to make you env is bothering. I want it automated.
When you say several people share the server, they also share the same user?
tom
tom
yes
terdon's solution of creating your own rc file seems like a good solution
just make .tomrc and source that for yourself
@tom So you need to execute 10 different scripts?
@terdon If I'm understanding correctly he just wants to setup his own personalized environment on 10 different machines but can't do that through the correct methods since they share users
4:05 PM
That's the kind of thing I am trying to understand: what is it you will be doing here. Are you installing things? Are these repetitive tasks? Why not store the commands in a script on the remote and then excecute that script when you log in? Why try to have sop many things in an "ssh command" construct, and then have an active interactive shell?
@jesse_b But one of the requirements is to end up with an open interactive shell, so for that I would just have a file with my commands, run ssh, source the file, continue with the open shell.
@terdon Maybe I'm misunderstanding but I didn't get that the goal was to end with an interactive shell but that later on when an interactive shell is established it will still have the changes from the previous commands
@jesse_b yes
tom
tom
@terdon yes
@tom think of something like this:
$ cat my_commands
alias c=clear
foo(){
  echo "Hello world!"
}
ls
cd /etc
That's a file named my_commands that you store on the remote server. Then, when you ssh, you just do this:
local $ ssh user@remote
remote $ . my_commands
remote $ do whatever else you want, you have everything set up now
tom
tom
Doing . my_aliases is a good idea.But if I'm allowed to wish more, I don't like putting and managing my_aliases files in several remotes because of source managing issue. I want to put them in my bastion server if I can.
4:09 PM
Since you do want an interactive shell, having one extra command (. my_commands) to run doesn't seem like a big deal
@tom what's a bastion server?
like a jump box I think
tom
tom
jump server
Then I would do something like defining a function on the bastion like this:
setup_remote(){
  scp my_commands user@remote
  ssh user@remote
}
Then:
bastion $ setup_remote
remote $ . my_commands
You still end up with a file on the remote, but you only have one file to maintain since it is copied over every time.
In any case, this is the kind of thing that should be mentioned in the question: explain that you want to avoid having multiple files. Explain that you need the setup on the bastion. Explain that you have a bastion.
ssh-custom () {
    _user=$(awk -F\@ '{print $1}' <<<"$1")
    _host=$(awk -F\@ '{print $2}' <<<"$2")

    scp /path/to/.tomrc "$_user@$_host:/home/some_user/"
    ssh "$_user@$_host" 'bash --rcfile /home/some_user/.tomrc -c ":; bash"'
}
tom
tom
4:14 PM
That seems great. Thank you. I will try in like 8 hours (I'm in Tokyo and it's 1AM now, nearly going to sleep....
@tom oh good grief, go, go rest! :)
@jesse_b yeah, something like that, exactly
untested and likely doesn't work but maybe can be tweaked to work lol

« first day (4926 days earlier)      last day (107 days later) »