New answers tagged ssh
0
votes
Routing response packets from IP/32 based on incoming interface incoming NIC
TL;DR
Just run these 3 commands to get the multi-homed setup working (only) with 10.10.30.33:
ip route add 10.10.20.0/24 dev eth2 table 1002
ip route add default via 10.10.20.254 dev eth2 table 1002
...
- 28.4k
0
votes
Add a remote server to known_hosts automatically without ssh-keyscan
Lets assume that from BusyBox, the host you want to add is 1.2.3.4.
On the host, run:
echo -n "1.2.3.4 " >> /tmp/known_hosts && cut -d' ' -f1,2 /etc/ssh/ssh_host_rsa_key.pub &...
1
vote
SSH to Cisco device fails with diffie-hellman-group1-sha1
I suppose that the next error that will appear after solving "diffie-hellman-group-exchange-sha1" issue will be
"no matching host key type found. Their offer: ssh-rsa"
So the ...
- 111
2
votes
Accepted
Does a cancelled scp transfer overwrite files with the same names?
scp does not do anything special with its target file(s). It uses a standard "truncate and write" approach, so the target file checkpoint.tar will now consist of a partial copy of your most ...
- 101k
0
votes
system locale are setting improperly on Redhat
dnf install glibc-langpack-en
Fixed it for me on AlmaLinux 9.1. Thanks to @Sérgio for the sug!
- 1,169
1
vote
Accepted
What is the fastest way to find the largest/smallest file in a folder with a few million of small files
Ten largest files:
ls -S | head -n 10
Ten smallest files
ls -S -r | head -n 10
- 24.2k
6
votes
Accepted
After SSH login linux output a kernel version
Option 1:
Add the following in /etc/ssh/sshd_config:
Banner /etc/banner
or
Banner /folder/mybannerfile
Write the message you want in the file and restart sshd
Option 2:
It seems it is possible to ...
- 2,308
8
votes
Accepted
How to ssh without password and using a different user name?
There's no obligation to have the same user name on the remote machine.
Your username on the local machine is jack
Your username on the remote machine is john
you can append john@<remote IP> to ...
- 19.4k
4
votes
Accepted
sshfs/fuse set limit/max size for a mounted folder on the ssh server for the connected user with sshd_config?
The SSH server does not have any control over the files or directories that are accessed via SSHFS/FUSE.
It is not possible to set a specific size limit or quota for a mounted folder on the SSH server ...
- 101
2
votes
Broken Pipe Way Ahead Of ClientAliveInterval * ClientAliveCountMax
That error is usually shown when the underlying TCP connection is interrupted.
It could be many things, for example the idle limit of the NAT table being used by the client (either at the router or ...
- 11.2k
1
vote
Remove internet access without losing LAN
If all of the nodes, including the master, are on the the same subnet 192.168.1.x/24 then they can communicate directly without any need for a gateway. Only nodes that need Internet access need a ...
- 101k
6
votes
Accepted
How to prevent other users from creating new SSH sessions?
When you are logged in as root, you can create a file named /var/run/nologin (historically /etc/nologin), and this should prevent non root users from logging in. When you are done your work as root, ...
- 681
0
votes
How to prevent other users from creating new SSH sessions?
Yes, it's possible. See man sshd_config for information on how to restrict who can authenticate.
You could add the AllowGroups root directive to the sshd config manually, then make the sshd service ...
- 15.6k
0
votes
SSHD Denies access with password + google-authenticator combo
@michaelkrieger answer is really nice, but I think it misses the point of explaining how to enable password authentication + google authenticator combo.
In my case, I followed this Digital Ocean ...
- 1
1
vote
Using ssh reverse tunnel as gateway to reach machine under NAT
Resolved:
Errors in what i've done:
first of all, 1.1.1.1 is not "all ips".
0.0.0.0 is.
second, I need to activate "GatewayPorts in ssh configuration
So:
Edit /etc/ssh/sshd_config , ...
- 11
0
votes
SCP from a distant server with a cumulative size limit
There is nothing in either scp or rsync that will address the specific requirement. However, it seems to me that a standard loop-until-done approach could work
#!/bin/bash
# A set of candidate files ...
- 101k
1
vote
Accepted
Curl Error 60 After Accidentally Deleting known_hosts file
Copy the missing file from the otherwise-identical Pi. See if that works
- 101k
1
vote
SSH returns Unable to negotiate ....: no matching host key type found. Their offer: ssh-rsa
Where 192.168.100.1 is your ip. Alternatively, you can set an alias, like laxssh that enables the option with -o
alias laxssh=ssh -oHostKeyAlgorithms=+ssh-rsa
ssh -oHostKeyAlgorithms=+ssh-rsa
If you ...
- 26k
1
vote
Can I disable ssh password authentication on the client side?
ssh won't prompt if in batchmode:
ssh -oBatchMode=yes you@theotherhost command
You could set
alias ssh /usr/bin/ssh -oBatchMode=yes
in your .bashrc which will disable password authentication from ...
- 3,727
4
votes
Can I disable ssh password authentication on the client side?
Client side command or ~/.ssh/config:
Here you can find some possibilities for your solution
To disable password authentication for the current ssh connection attempt
To disable password ...
- 2,308
1
vote
Accepted
ssh EOF in bash script - how to store value of command?
Fixing up the current way of doing things
ssh $USER@server.com << EOF
cd /data/dev/${ARK_PATH}/
./gradlew bootRun --no-daemon
LATEST_FOLDER=\$(find . -type d -exec stat --printf="%...
- 17k
4
votes
Variable username in SSH config
The $USER doesn't work on all systems or version if you don't have a customized bash/ssh environment, because bash does not interpret your ssh config file
You can fix this with
your .bashrc file or ...
- 338
6
votes
Variable username in SSH config
Use the $USER environment to set a user
Host MYHOST
Hostname MYHOST
User $USER
Check this for more SSH Environment Variables
SSH Environment Variables
Passing env variables to a ssh ...
- 2,308
0
votes
ssh error while logging in using private key "loaded pubkey invalid format" and "error in libcrypto"?
I just have fixed this problem. This problem was caused because of the format of the text.
Replace following the ssh-key format, Its looks like this:
-----BEGIN OPENSSH PRIVATE KEY-----
...
- 1
4
votes
How do I set the maximum ssh session duration?
Hmm, doing it THROUGH SSH would be prohibitively difficult. I think the easiest way would be to have a background program start running every time you have an ssh login to a specific account, which, ...
- 2,308
2
votes
How do I set the maximum ssh session duration?
There isn't an sshd_config option for terminating active sessions after a period of time. The customary way of doing this is to run a task on the server that notices an ssh session has lasted too ...
- 2,635
1
vote
ssh caches host names?
As mentioned in roaima's comment, it turns out that there were hardcoded IP addresses in the ssh config file (~/.ssh/config) that were overriding the /etc/hosts file entries.
- 5,261
0
votes
Cannot figure out how to turn off StrictHostKeyChecking
I'm not normally in the business of telling other people how to run their server administration, but...
If you're in a position where you find yourself passing eight variables to a one-liner shell ...
- 30.3k
1
vote
Linux SSH disconnects and mouse left click and scroll pastes weird sequences
These are mouse events data. Try input reset. It works for me.
- 121
0
votes
nohup process pid not visible in new shell but still in old shell
If you run ps from a different shell, you will see only processes initiated by that shell session even with root privileges. To see processes initiated by other users or in a different session, use ...
- 2,008
0
votes
annoying message "X11 connection rejected because of wrong authentication" while there is no problem at all
Adding this answer because none of the other answers here worked, and all seem to highlight unnecessary trouble-shooting steps that will likely mess up your configuration even more. (Another reason ...
- 101
15
votes
Accepted
Cannot figure out how to turn off StrictHostKeyChecking
The StrictHostKeyChecking=no argument needs to be passed as an option to the ssh command, rather than as an option to the remote shell command. So for example:
ssh -i "$8" -o ...
- 76.3k
6
votes
Cannot figure out how to turn off StrictHostKeyChecking
If disabling at run time with command line options doesn't work, then disable it in your ~/.ssh/config file. You can create the file if it doesn't exist,remember to give it rw-r-r permissions with
...
- 2,308
2
votes
config file for ssh ProxyCommand after a ProxyJump
This doesn't really help with my lack of mental modeling about how ProxyJumps and ProxyCommands work and interact, but I did find a way to accomplish the specific task outlined in the question.
After ...
- 1,221
0
votes
Copy ssh keys to a new computer
I strongly disagree with the answer by Seamus. Yes, it is good practice to replace your keys at appropriate intervals. Tying that to when you replace your hardware is usually not a good idea. You have ...
- 4,683
-1
votes
What is the default password for a Linux Mint live usb
In a shell you can getsuperuser privileges with "sudo -s".
Doesn't prompt for a passwd.
mint@mint:/dir/
becomes
root@mint:/dir/
- 1
1
vote
Accepted
Copy ssh keys to a new computer
Yes, if you change the machine from which you access your servers, you can just copy the ~/.ssh directory from the old machine to the new one. It is unnecessary (and cumbersome) to generate a new key ...
- 27.7k
0
votes
Copy ssh keys to a new computer
No - it's not considered best practice to copy your ~/.ssh folder to a new computer. Instead, on your new computer, create your ~/.ssh folder from scratch using:
$ ssh-keygen
followed up by:
$ ssh-...
- 2,404
0
votes
Can't detach from tmux session while process is running
In fact, I forgot to hit "ctrl + b", release, and then d. I did it without releasing. Thanks to @KamilMaciorowski!
Seems to be not well explained in the web.
1
vote
SSH: Permission Denied (publickey,password)
ssh-copy-id uses SSH to copy your public key into the ~/.ssh/authorized_keys file on the target user account on the target system.
In order to do so, you will need to provide it with the means to log ...
- 30.3k
0
votes
How do I use the same SSH configuration for root and a normal user?
The systemwide ssh config path is /etc/ssh/ssh_config for Ubuntu. For me it worked out.
- 294
0
votes
Xauthority problem xdpyinfo: unable to open display "".
Along with all the above on macOS13 Ventura you must:
In System Settings, General, Allow in Background, XQuartz must be turned on.
- 1
0
votes
Use specific key in a forwardagent ssh call?
There is a solution:
https://superuser.com/a/273094/1760623
You can use the public part of a key to specify which private key you want to use from the forwarded agent.
- 1
1
vote
Accepted
How to SSH to a host and attach an LXC container in one command, properly?
Add the "-t" option to your ssh invocation:
sshc() { ssh -t $1 "lxc-attach $2; bash -i" }
When ssh is invoked with a command to run on the remote system, it doesn't allocate a TTY ...
- 2,900
-2
votes
how to avoid ssh asking permission?
Removed both the all the existing keys from known_hosts and Ran it again. This time the right key has been added and no more having the issue.
- 97
0
votes
SSH 7.4 prolonged pause at "pledge: network"
In my case, the issue was caused by excessive load on the ESXi host when it restarted due to a prolonged power failure.
On power restoration, a Ubuntu VM hosting several (>30) LXC containers ...
- 529
0
votes
ssh stuck at expecting SSH2_MSG_KEX_ECDH_REPLY
I've had the exact same problem and have it solved this way:
Option 1 (one-time use):
At the comand line when submitting the SSH connect comnand, add "-oKexAlgorithms=ecdh-sha2-nistp521" ...
1
vote
How to start ssh-agent without eval
Can I somehow pass the environment variables to all terminals currently open?
Not without writing the variables to a file and manually sourcing that file in each terminal.
Can I pass the environment ...
- 80.1k
0
votes
Accepted
When exchanging keys between source and target systems, does local account have to exist on a remote system as well?
The sftp server will look in the remote home directory ~username_remote/.ssh/authorized_keys if the
local private key matches the public key in authorized_keys, so
sftp username_local@server_remote ...
- 24.8k
0
votes
X11 forwarding request failed on channel 0
Usually when I see the error message of the question title, it means the server does not have the package that contains the xauth command installed, or the sshd daemon cannot use the xauth command for ...
- 80.1k
Top 50 recent answers are included
Related Tags
ssh × 7734linux × 1031
bash × 667
ssh-tunneling × 495
openssh × 492
ubuntu × 477
sshd × 387
shell-script × 371
shell × 370
networking × 309
centos × 300
scp × 297
key-authentication × 295
debian × 283
x11 × 276
remote × 273
security × 246
sftp × 219
rsync × 204
terminal × 200
ssh-agent × 183
port-forwarding × 174
login × 172
password × 155
putty × 134