New answers tagged

0

My favorite way (in ~/.bashrc): function bassh() { local host=${1:?'arg #1 missing: remote host'} shift local command="$@" local usage="bassh REMOTE_HOST COMMAND" [ "$command" ] || { echo -e >&2 "[error] no command provided\nUsage: ${usage}" return 1 } ssh ${host} -t bash -ic "'${command}'" } Note the -t ...


0

If anyone was still having issues and is an idiot like me, make sure you didn't create the new directory (on your local system) using sudo. Because then you, (the local user), won't have write access to it. Which makes it impossible to use as a mount point. Quick fix for this is sudo chown -R localuser:localuser ~/directory_you_created (Swap out ...


0

There was the same problem. Decided her like that: chmod 0600 /home/<user>/.ssh/*


2

Looks almost OK. Try the following (untested obviously) #!/bin/bash #checks to see if programA is already running if pidof -x "programA" >/dev/null; then echo "Program A already running" exit 1 fi expect <<EOF spawn ssh username@${1} expect "assword:" send "password\r" expect "$ " send "nohup ./programB &\r" # run programB in ...


1

Message of the day is in /etc/motd. If it is another message, then find it with. find /etc -mount -type f -print0 | xargs -0 grep -F 'some text from the message'


0

There is another reason for the sshd OpenSSH Server being stuck in the "activating" state. Namely, the cause could be "entropy exhaustion" which prevents the related OpenSSL module from getting initialized. To verify that "entropy exhaustion" is really the problem, first stop the OpenSSH service, so it is no longer stuck in the "activating" state, by ...


0

I was having this warning msg with scp and ssh when I used the -i option. I found that cause was extra in public key file. my pub key file had 2 lines with 'wc -l'; i deleted the extra and now it only has 1 line with 'wc -l' and there are no warning messages. I should clarify that ssh and scp worked correctly with and without the warning message.


0

It is not mandate to keep your hostname encrypted 192.168.0.105 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIl8BT33T4sEAgG56CItPWep/N3IKaUaw8Xy6Fn6k9SLsARi9zZk9FAd6H6DfbIxzkz1sjSjfq1JSVyd3slKf4M=


1

A server/device can see only mac addresses of other devices in local network, but not devices behind a router. So if one device can directly connect another - they see macs of each other. But if one device should go through a router to connect another device (not switch or wifi switch, but router facing your two devices using different network interfaces), ...


0

You can not see your real client mac on your server. There you see only gateway (router, etc) mac. You must read something about networks and protocols.


1

Once I submitted the question, I noticed that there is an entry on a similar file (ssh_known_hosts) file in the manual of sshd. man sshd The manual states: Hostnames is a comma-separated list of patterns (‘*’ and ‘?’ act as wildcards); each pattern in turn is matched against the canonical host name (when authenticating a client) or against the user-...


0

I figured out finally thank you @Kusalananda ssh ubuntu@$ip -n "aws s3 cp s3://bucket/$userlistlocation . --region eu-central-1; fbname=$(basename $userlistlocation) ; echo \"\$fbname\""


1

You are looking for the multiport iptables extension so put: iptables -A INPUT -p tcp -m multiport --dports <port1>:<portn> -j ACCEPT somewhere after rule 3 in your firewall script. Remark: Rule 2 (rejecting packets destined to localhost) is weird: many local processes communicate over the lo interface. Usually you use the reverse rule: ...


0

An alternative approach would be cat do_sync | ssh "root@ip" 'nohup sh -s' I'm assuming the effect you see is because you're executing ./do_sync in the background. It only appears that the process still hangs. Unless you're actually seeing an open connection?


1

You might try the yes command if that is available on your distribution, see e.g. What is the point of the `yes` command? What is the point of the "yes" command? for examples (and yes, these are two different questions despite the almost-same title).


3

Pipes (|) are used for connecting inputs and outputs of several command together in a pipeline. The commands run independently and concurrently with each other, apart from when they are waiting for input to appear or for output to be read. This is why the cd does not affect the current directory of the gitand sbatch commands. You don't want to use a ...


0

This works to me: ssh user@remote.de -t "cd /home/h/usr/praktikum && git pull && sbatch run.sh; bash --login" For not will leave you in a remote shell: ssh user@remote.de -t "cd /home/h/usr/praktikum && git pull && sbatch run.sh"


0

I executed almost all the above commands and I think the best way to find the currently logged in users via ssh are last | grep "still logged in" AND who -a


0

Combining these answers allowed me to clone to another Linux host and avoid the 'permission denied' error: RPI4 SD card (/dev/mmcblk0 - this clones the entire card) avoid permission issue by prompting for elevated privilege (sudo -S) see progress as it copies (status=progress) compressing the copy (gzip) ssh user@1.1.1.1 "sudo -S dd if=/dev/mmcblk0 status=...


0

As this questions appears among the first search results when googling for this behaviour, I will also add my solution: In my case it was nothing related to the permissions. For any reason (didn't bother myself to find out for which reason actually, as I found a quick fix) when executing the ssh command the program didn't look for the right identity file. ...


0

As this questions appears among the first search results when googling for this error, I will also add my solution: In my case it was nothing related to the permissions. For any reason (didn't bother myself to find out for which reason actually, as I found a quick fix) when executing the ssh command the program didn't look for the right identity file. One ...


1

Using Jeff's idea of using a here-document for the sed script itself (well, he mentions a "here-string", but you'd have issues with quoting there too I think): ssh host 'sed -i -f - /etc/mail/sendmail.mc' <<'SED_END' s/dnl MASQUERADE_AS.*/MASQUERADE_AS(`domain.com')dnl/ SED_END If the sed on the remote host can read a sed script from standard input ...


1

This is a standard message when the "I'm going to restart" flag is set. This is typically either the file /etc/nologin or /var/run/nologin. It's checked by the PAM module pam_nologin (see man pam_nologin for details). Even though normal logins are blocked you should still be able to log in as root, at which point you can remove the flag file, or run ...


0

Let's assume ServerA is your computer at home and ServerB is the remote server. In order to connect via public/private key, we need to create a set of keys on ServerA. Please note that I did not enter a password. ServerA $ ssh-keygen -t rsa -b 4096 Generating public/private rsa key pair. Enter file in which to save the key (/home/admin/.ssh/id_rsa): Enter ...


0

You can add a login manager (say, lightdm) and configure autologin. Even run x11vnc at the start of the user's sesion. Alternatively you can run vncserver as the user and then connect directly to it, via ssh forwarding: ssh -L5904:localhost:5905 user@example.com vncserver :5 # only if the server has not been started and then, on the client you can run: ...


2

The login failed, because there is no setting for PermitRootLogin in /etc/ssh/sshd_config which defaults to prohibit-password, which means password login is disabled for root. Adding PermitRootLogin yes to the Match block would allow root to login with password or public key authentication. Another option would be to use a different user.


0

You can modify the SSH config file to force it to not use these weak key exchange algorithms, encryption algorithms and hashes. I've come across the same issue with the same results from a Nessus scan. Edit the sshd_config file located here: /etc/ssh/sshd_config And enter this block of text somewhere in the config file: # Ciphers and keying # If ...


0

You either need to be root to bind ports below 1024 or have the CAP_NET_BIND_SERVICE capability. In order to obtain it run: sudo -E -- setpriv --inh-caps +net_bind_service --ambient-caps +net_bind_service --reuid $USERNAME /bin/bash This runs as root the setpriv utility, which switches back to your uid, but adds the CAP_NET_BIND_SERVICE capability.


0

You need to be root on pc1 aka 10.0.1.2 in order to redirect ports less that 1024, rather than ssh_user. Since you can bind port 83 if you are logged onto pc1 (presumably as root), it might be easier to start from pc1 and ssh to s1. Use '-L' to bind port 83 locally rather than '-R'.


0

I ran into this exact error when trying to connect to all my remote hosts via the Wi-Fi bridge option on my Android device (Huawei P30 Pro). When I used the USB tethering option to share the same Internet connection, no problem. Absolutely nothing else changed in the SSH configuration or options on the client or servers. TL;DR: sometimes, nothing you can ...


2

Will android-c0f659b6548c28b2 change under some cases, for example, when the phone is restarted, moved to a different LAN, assigned a different IP address, ...? It should only change when you factory-reset your phone (which may also happen as a side-effect of unlocking its bootloader). From the command line, it could be queried by the getprop net.hostname ...


0

Yes... you can use ~/.ssh/config instead of ssh-agent just add this in ~/.ssh/config file Host github.com IdentityFile /my/individual/path/id_rsa


0

The key that needs to be used is the one originally configured to login to $VPS.


0

It is an order-of-operations issue. The SSH client is trying to pre-emptively set up the connection to port 9190 of the home computer right after the SSH connection is established, before the remote nc at the university system even starts. If the local port 9190 is not listening at that time, the remote forwarding set-up will fail. So, you'll have to run ...


2

B is just handling everything it gets to A. A must choose where to retrieve data depending on its data. Clearly only A should have the DynamicForward tunnel, the role of B is just an intermediate host for connectivity. Normally B should only require a classic LocalForward to present queries to A. This could be done in different ways, but the most simple and ...


2

Your user's PATH environment variable does not contain the path where these files are located. When you use su -, root's environment variables get loaded into your session. See man su: -, -l, --login Start the shell as a login shell with an environment similar to a real login: o clears all the environment variables ...


1

This isn't an issue with android. I believe the convention of putting keys in ~/.ssh/authorized_keys is from OpenSSH. I don't believe it's part of the standard (RFCs). SimpleSSHD has a different convention: Quick start Install SimpleSSHD. On any computer which will connect to your Android device, set the port to 2222. With OpenSSH, this can ...


-1

Config settings for the SSH server are often in /etc/ssh/sshd_config but the first thing I would check is the location and the permissions of the public key and its parent directory that you copied to the server. /etc/ssh/sshd_config should be like this . sshd service need to be stopped and started again PermitRootLogin yes RSAAuthentication yes ...


1

Building on the other answers, as of 2019, ED25519 is becoming widely used and supported; most experts I follow believe it is a better choice than ECDSA (because it is thought to be free of any backdoor by any national security agency). In summary, ECDSA is not fully trusted, RSA 1 is outdated. DSA is outdated. RSA (v2) is on the way out. That leaves only ...


0

You can use a restricted shell like rbash or rssh to restrict the capabilities of users. (Or VirtFS/jailshell if you're willing to go that far.) Here's an example from RH on using rbash: https://access.redhat.com/solutions/65822


0

Easy fix. Make sure YOU are root. SCP to the remote and it will ask you for that machines root password. Just had this problem that was the solution. You root them root.


0

localhost is from the point of view of school_server.edu. So it is trying to connect to 9190 on the remote. I think you want it to connect to your local. Therefore (and this bit I am not 100% sure about) you should drop the host name. ssh -R 9999:9190 my_user@school_server.edu


0

The app that listens to port 5006 should bind to 0.0.0.0 instead of 127.0.0.1 (unless it already does and the restriction is caused by a firewall) Traffic to port 5006 should be allowed (by the server's own firewall and/or by nearby routers) or you can reconfigure the app to listen to some allowed port (80, 443...).


0

Only with that infomration the only way to achieve what you want would be with an iptables rule that would redirect all the MAC addresses that are different from yours to the desired port. For example something like this: iptables -t nat -A PREROUTING -p tcp --dport 22 -m mac ! --mac-source 11:22:33:44:55:66 -j DNAT --to 123.12.12.123:5006


1

When using the NordVPN Linux client, iptables are used to change traffic instead of modifying the routes. To allow SSH to go through, you need to whitelist the SSH port. nordvpn whitelist add port 22


0

An alternative is to leave ssh alone (meaning for example that you can also apply updates and security fixes without recompiling). You then do your out-of-bound communication with a wrapper, using port forwarding instead. That's already been done, check the -M flag in autossh.


0

Here is a screen shot of general setting that you need for Filezilla to SFTP using SSH credentials. Hope this helps.


0

Things are fine after a reboot. So maybe restarting ssh-agent would have had helped.


1

Independant file descriptor for one or more SSH connections I addition to ControlPath and ControlPersist correct way, proposed by muru's answer, I would like to present an alternative: Method Create a fifo you will use for ssh's outputs You have to create this file in a path you are confident mkfifo $HOME/sshfifo Run long-running command: exec 8> &...


1

You can use cat to concatenate all the files and then pipe them to ssh. cat command1 command2 command3 | ssh root@host 'bash -s'


Top 50 recent answers are included