Skip to main content

All Questions

Tagged with
2 votes
1 answer
579 views

Pass ssh remote command from bash to zsh

I am running a remote putty session from windows to my Red Hat Enterprise Linux server. Due to company restrictions, I am unable to change my Linux user's default shell from bash to zsh. I instead ...
Adam Griffiths's user avatar
0 votes
1 answer
148 views

Can I pass a subsequent script execution to an established ssh connection shell

I want to execute a script portion after a successful ssh connection has been established. I'd like to make it easier for me to tail a log file with a script I am trying to write. Here is the script ...
xetra11's user avatar
  • 546
4 votes
1 answer
11k views

Passing env variables to a ssh connection

I want to pass enviromental variables to a ssh connection. They should be passed dynamically, therefore hard-coding them into the config file of ssh won't work for me. I've tried this: AAA="...
kosmosu05's user avatar
3 votes
4 answers
2k views

Source a file after ssh login drops to prompt

One-liner question: How do I automatically source a remote file on remote host after logging in via SSH via a bastion host? I need to source a file containing a list of aliases + shell user defined ...
mtk's user avatar
  • 28.4k
9 votes
1 answer
7k views

bash like autocompletion for ssh command in zsh shell with /etc/hosts file?

zsh is great so far. I am using zsh-completions but still I am unable to get autocompletion for ssh commands like in bash as shown in below screenshot: How to get hostnames from /etc/hosts for ssh | ...
Akhil's user avatar
  • 1,350
0 votes
1 answer
5k views

Multi-user env, SSH ZSH - command not found: shopt

I just installed ZSH on a remote server where we are 2 "admins". I switched my default shell to ZSH with chsh -s $(which zsh). echo $SHELL gives the output /usr/bin/zsh which proves it. But, when I ...
Dzintars's user avatar
  • 115
1 vote
1 answer
577 views

connect to ssh and execute command in spite of changing shells after login

I am trying to connect to a server via ssh and then execute a command. So far so simple. The twist is that on that server, I start zsh from my bash. So in my .bashrc I have the command: exec /bin/...
cmplx96's user avatar
  • 143
3 votes
1 answer
3k views

$SHELL in tmux is different than $SHELL in the shell that I launched it from

Been wrestling with this for a few hours and it’s driving me crazy. When I SSH into my machine at home, my default shell is zsh. I can confirm this with echo $SHELL, which outputs /usr/bin/zsh When I ...
Joseph Morgan's user avatar
3 votes
2 answers
3k views

Proper way to code dry run option without having to repeat myself?

I'm coding a script that goes and searches for files on a remote server and transfers them back to my local computer. I want to be able to do a dry run first, so I know which files I'm bringing back. ...
dylanjm's user avatar
  • 211
5 votes
3 answers
2k views

What happens if a users default shell is not installed?

I work as a sysadmin in a large company and have to maintain several windows and Linux (Ubuntu 16.04) VMs. Since I want to use zsh instead of bash on the Linux VMs, I have to change my default shell. ...
Daan Boerlage's user avatar
14 votes
2 answers
3k views

Why doesn't the process substitution <() work with ssh -F

I have some vagrant virtual machines. To log into them I issue the vagrant ssh command. I want to log into them using regular ssh command. The vagrant ssh-config outputs the suitable config file $ ...
cbliard's user avatar
  • 402
8 votes
4 answers
12k views

Bash Auto-Completion feature for SSHing into Different Hosts

I have big list of servers which I normally ssh to all the time. Is there any way using bash or zsh so that I can keep the list of hostname and bash auto-completion goes through the file and gives me ...
pradeepchhetri's user avatar
4 votes
1 answer
2k views

scp, globbing, and different shells

The other day at work I tried doing scp remotehost:~/*.txt . and I received an error about the *, *.txt file not found sorry, not at work and I forget the exact error on my workstation I run zsh 4....
xenoterracide's user avatar