How can I edit the welcome message when ssh start?
You need to edit two files: /etc/motd (Message of the Day) /etc/ssh/sshd_config: Change the setting PrintLastLog to “no”, this will disable the “Last login” message. And then restart your sshd.
You need to edit two files: /etc/motd (Message of the Day) /etc/ssh/sshd_config: Change the setting PrintLastLog to “no”, this will disable the “Last login” message. And then restart your sshd.
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‘s ssh public key is present in B:~/.ssh/authorized_keys B‘s ssh public key is present in C:~/.ssh/authorized_keys In ~/.ssh/config on A, add Host C ProxyCommand … Read more
mysqldump –opt <database> | gzip -c | ssh user@wherever ‘cat > /tmp/yourfile.sql.gz’ You can’t use tar in a pipe like this, and you don’t need it anyway, as you’re only outputting a single file. tar is only useful if you have multiple files.
bash -x script or set -x in the script. You can unset the option again with set +x. If you just want to do it for a few commands you can use a subshell: `(set -x; command1; command; …;)
The ~/.ssh/config file don’t have a directive for including other files, possibly related to SSH’s check for file permissions. Suggestions around this can include a script to cat several changes together either on the system or via checkin hooks on a repository. One might also look into tools such as Puppet or Augeas. However you … Read more
What can be simpler than echo $!? As one line: myCommand & echo $!
You can use the -s switch to su to run a particular shell su -s /bin/bash -c ‘/path/to/your/script’ testuser (Prepend sudo to the above if testuser is a passwordless user.)
Use screen, a free terminal multiplexer developed by the GNU Project that will allow you to have several terminals in one. You can start a session and your terminals will be saved even when you connection is lost, so you can resume later or from home.
Most likely your ls is aliased to ls –color=auto, which tells ls to only use colors when its output is a tty. If you do ls –color (which is morally equivalent to ls –color=always), that will force it to turn on colors. You could also change your alias to do that, but I wouldn’t really … Read more
This will put your text into your variable without needing to escape the quotes. It will also handle unbalanced quotes (apostrophes, i.e. ‘). Putting quotes around the sentinel (EOF) prevents the text from undergoing parameter expansion. The -d” causes it to read multiple lines (ignore newlines). read is a Bash built-in so it doesn’t require … Read more