Hot answers tagged

71 votes

How do I set time and date from the Internet?

A small command I found to update your time in case you don't want to install anything just to update the date. :) sudo date -s "$(wget --method=HEAD -qSO- --max-redirect=0 google.com 2>&1 ...
Prashant Kabade's user avatar
29 votes
Accepted

How do I scp via ssh?

To copy from REMOTE to LOCAL: scp -P 12345 user@server:/path/to/remote/file /path/to/local/file To copy from LOCAL to REMOTE: scp -P 12345 /path/to/local/file user@server:/path/to/remote/file Note:...
jesse_b's user avatar
  • 36.8k
28 votes
Accepted

Change a directory name in a Github repository remotely, directly from local Linux Git?

The fatal error message indicates you’re working from somewhere that’s not a clone of your git repository. So let’s start by cloning the git repository first: git clone https://github.com/benqzq/...
Stephen Kitt's user avatar
18 votes

"Invalid MIT-MAGIC-COOKIE-1 key" when trying to run program remotely

This one worked for me. So I'm leaving this answer here. export DISPLAY=:1.0
PSN's user avatar
  • 289
18 votes
Accepted

How to remote execute ssh command a sudo command without password

you can tell sudo to skip password for some command. e.g. in /etc/sudoers archemar ALL = (www-data) NOPASSWD: /bin/rm -rf /var/www/log/upload.* this allow me to use sudo -u www-data /bin/rm -rf /var/...
Archemar's user avatar
  • 31.5k
18 votes
Accepted

Turning encrypted system on remotely

You can enable this by installing dropbear-initramfs and following the instructions to configure your SSH keys. This will start an SSH server from the initramfs, allowing you to connect remotely and ...
Stephen Kitt's user avatar
17 votes
Accepted

Does rsync have to be installed on the remote server?

You need to install rsync in both source and destination machine. rsync works by doing quick calculations at both ends looking at the timestamps and existence of all the found files in a particular ...
Wissam Roujoulah's user avatar
16 votes

.ssh/config to start remote session in zsh

For anyone arriving here years later, since 2017 it's possible to put everything in the config file: Host host_1 HostName 1.2.3.4 User root Port 22 RequestTTY yes RemoteCommand ...
Saskia Keil's user avatar
15 votes

How can I use files from HTTP as prerequisites in GNU make?

Try something like this in your Makefile: .PHONY: local.dat local.dat: [ -e example.gz ] || touch -d '00:00' example.gz curl -z example.gz -s http://example.org/example.gz -o example.gz [...
cas's user avatar
  • 78.3k
14 votes
Accepted

Password problem x11vnc

I was able to correctly set up the autostart for x11vnc server by creating a symbolic link from the executable to the "autostart-scripts" folder: Creating a symbolic is not needed. Store your ...
Arpit Agarwal's user avatar
13 votes

Closing connection after executing reboot using ssh command

Some answers were close, but the right answer is: ssh [email protected] "nohup sudo reboot &>/dev/null & exit" explanation: you want to exit as the last command so the status of the ...
nachoparker's user avatar
13 votes
Accepted

How to read man pages from a remote machine

As already stated in the comments, I don't really believe that -m can display manpages from a remote machine. To display a manpage from a remote machine you need something like: $ ssh freebsd 'man ...
Arkadiusz Drabczyk's user avatar
12 votes

How to remote execute ssh command a sudo command without password

The most simple way is to provide password from stdin if your sudo supports that (-S key) ssh -t admin@remotehost "echo <yourpassword> |sudo -S <yourcommand>"
user1700494's user avatar
  • 2,202
11 votes

How to run a process overnight on a remote server after quitting out ssh

As the other answers suggest. You can use nohup <command> &. You can also use screen, this (basically) is a detachable terminal. You can start a terminal using the command screen and when ...
Hunter.S.Thompson's user avatar
10 votes

How can I get the address of my local machine?

I just got the shortest way around this $ who root pts/22 2016-12-28 13:22 (179.xx.xxx.xx) If connected via ssh. This will display the user logged in plus the IP address
Radiumrasheed's user avatar
10 votes

How to copy symlinks as symlinks from one machine to another?

I know @polemon has already answered this. But doing my tad bit for quick solution. I had to do man rsync to know which switch I wanna use... rsync -avz -e ssh /file or sym link/to/copy/ user@ip:/...
HarshaD's user avatar
  • 366
10 votes
Accepted

Can vim edit a remote file as root?

I'm going to say this is not possible because vim is not executing remote commands. It is simply using scp to copy the file over, edit it locally and scp it back when done. As stated in this question ...
Zachary Brady's user avatar
10 votes
Accepted

Executing a remote command

If you specify a remote command, then the ssh connection is going to close as soon as the remote command exits. A cd command will exit almost immediately. A common way to do what you want is: ...
Kenster's user avatar
  • 3,390
9 votes

redirect sound (microphone) via ssh, how to telephone via ssh?

Erik's answer works well, but using it how it is, using flac or oggenc, there's significant lag. A solution is to add -cache 256 to the mplayer command, so it would look as follows: ssh <user>@&...
confetti's user avatar
  • 1,942
9 votes
Accepted

How to recursively uncompress gz files on a remote host with limited commands?

To extract your files, you need to use gzip: gzip -d *.jpg.gz You mention doing this recursively; given that you don't have find, you'll have to visit each directory in turn and run the above ...
Stephen Kitt's user avatar
8 votes

How to recursively uncompress gz files on a remote host with limited commands?

If shell of the host you are sshing to is bash version >= 4.0, you can enable the globstar option. When enabled, the ** glob will recursively match subdirectories. So the following should do what ...
Digital Trauma's user avatar
8 votes

Mounting windows share with write permission for both root and user

sudo mount -t cifs //MOC/php /home/gameboy/Pulpit/Windows-Share -o user=wat,username=gameboy,password=fakepassword,dir_mode=0777,file_mode=0777
trzczy's user avatar
  • 640
8 votes
Accepted

Kill remote process via ssh

The $(..) command substitution would fail as the $ is expanded by the local shell even before it is passed to the stdin of the ssh command. You either need to escape it or use here-strings. Also the ...
Inian's user avatar
  • 12.7k
8 votes

How to edit a text file without a text editor?

In that instance, I'd try transferring files out and editing them on another computer, then transfer them back. If you have ssh, you should have scp (I hope), so you should be able to push files in ...
faxeyo's user avatar
  • 81
7 votes

How to dd a remote disk using SSH on local machine and save to a local disk

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 ...
Paul Sturm's user avatar
7 votes

How to create a virtual machine from a live server?

Physical to virtual - P2V - is the procedure you are looking for. rsync will not help in this case. You should use a Vmware's free VMware Converter tool to convert the disks of your physical server to ...
magor's user avatar
  • 3,742
7 votes
Accepted

View script output over ssh in real time

Use the -u flag to python: cat printdelay.py | ssh user@host python -u The behavior you're seeing is because, when writing to stdout when stdout is not an interactive device such as a tty or pty, ...
jayhendren's user avatar
  • 8,354
7 votes

Log off remotely

You can use the command who -u that gives the list of users logged in, along with the PIDs of the shell sessions. root@server:/# who -u root - pts/0 2017-08-08 15:52 00:08 21934 (192....
Gohu's user avatar
  • 2,064
7 votes
Accepted

Alternatives to nfs that rely on username/password or public key authenthication

If it's the performance of NFS you want without a more "tricky" setup then your only other real option is CIFS/SMB (e.g. by mounting a Samba share). In terms of difficulty I'd say Samba setup isn't ...
Anon's user avatar
  • 136

Only top scored, non community-wiki answers of a minimum length are eligible