Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
For example, I have two remote machines. Let's say, A, B.
Usually I can do vim scp://A/path/file to remote edit A's files locally.
So, is there a way to edit machine B, which can only be accessed from A, from host machine using vim directly? Thank you very much.
The topology:
+---------------------------------------------------------------+
| |
| |
| +--------------+ +-----------+ +-----------+ |
| | | | | | | |
| | HOST | +----> | A |+--->| B | |
| | | | | | | |
| +--------------+ +-----------+ +-----------+ |
| |
+---------------------------------------------------------------+
I agree with #Conner that this is a ssh-tunneling question but here is a possible answer anyway..
Install netcat on host 'A'
Add this to your $HOME/.ssh/config:
Host RemoteHost
Hostname B
User UsernameOnB
Port 22
ProxyCommand ssh UsernameOnA#A 'nc %h %p'
You would have to replace 'A', 'B', 'UsernameOnA' and 'UsernameOnB' with the matching hostnames or IP addresses for A and B (and check if netcat is installad as 'nc' or 'netcat' I've seen both..)
After that you should be able to:
$ vim scp://RemoteHost/path/to/file
This setup works best if you have public-key access to both systems, otherwise you will be prompted for passwords.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I have this command run on Finnix OS:
dd if=/dev/sda | pv | gzip -9 | ssh root#LinodeIP "gzip -d | dd of=/dev/sda"
I got it from this artical: https://github.com/ClickSimply/docs/blob/windows-on-linode/docs/tools-reference/windows-on-linode/installing-windows-on-linode-vps.md
And I understand that this command will compress a file using gzip, then upload it to a server and run gzip command in that server to extract it. My question is what is the right command to save the gzip file in local computer instead of sending it to a server?
Thank you so much.
dd if=/dev/sda | gzip -9 > /path/to/output/file.gz
should do it.
if you would still like to see the progress with pv then
dd if=/dev/sda | pv | gzip -9 > /path/to/output/file.gz
should be the way to go
EDIT: worth to note, cat is the best way in my opnion to do this nowadays, as it uses the full potential of the hardware. dd was OK where you were limited by the drive speed, (like tapes, still being used for backups nowadays in some places and dd is fine there)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I am using putty ssh client in windows to login to remote machine
I transfer files using scp and pscp from my local to server
scp:
scp -r script-1/ root#104.130.169.111:/mounarajan/script-1
Response in command line:
artist_dedup_urls1 100% 414KB 413.8KB/s 00:00
reverbnation_crawler.py 100% 21KB 21.0KB/s 00:00
pscp:
pscp -r script-1/ root#104.130.169.111:/mounarajan/script-1
Response in command line:
artist_dedup_urls1 | 413 kB | 413.8 kB/s | ETA: 00:00:00 | 100%
reverbnation_crawler.py | 21 kB | 21.0 kB/s | ETA: 00:00:00 | 100%
But after this the script-1 folder in server machine is empty.
Where is the problem actaully?
Did you deleted the "script-1" on 104.130.169.111 before? Your situation seems to be the same as this scenario:
On command window 1: cd to certain directory, say "a/b/c"
On another window: delete "a/b/c", recreate it and copy in some files
On command window 1: no change can be seen.
Solution is: on command window 1, cd to another directory and then cd back to "a/b/c" again to access the newly created directory
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I can't directly access target host, need ssh as a proxy.
How can I kill a process from local use ssh ? I try this:
ssh root#$center "ssh root#$ip \"ps -ef|grep -v grep|grep $target_dir/$main|awk '{print \$2}'|xargs kill\""
it got error:
kill: can't find process "root"
And how to avoid error where process not exist ?
Suppose your process' name is name, then you can try something like this:
ssh hostname "pid=\$(ps aux | grep 'name' | awk '{print \$2}' | head -1); echo \$pid |xargs kill"
Use pkill -f to easily kill a process by matching its command-line.
ssh root#$center ssh root#$ip pkill -f "$target_dir/$main"
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
When I get my public IP from terminal using this command:
ifconfig ppp0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'
It is 10.98.181.87
But when I use external service it reports a different IP:
wget http://ipecho.net/plain -O - -q ; echo
IP addresses that start with 10. are internal, not public. Somewhere between you and the Internet, there's a router doing Network Address Translation so that a relatively small number of IP addresses can be shared amongst a relatively large number of computers.
The IP Address given by ifconfig is your local IP of your machine assigned by the router or Access Point (if dhcp is enabled). Where as the IP address seen using wget http://ipecho.net/plain -O - -q ; echo is the IP address of the router. Even if you do wget http://ipecho.net/plain -O - -q ; echo from different systems connected to your network,all systems will show the same IP address as you get on your system.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
Ubuntu: service --status-all can't be with | more or | grep git
I see long list of running services, I just can't see it by page or filter it. The above additons don't affect output.
It seems that service --status-all uses stderr and stdout. grep or more does not affect on stderr. We need to use redirection.
service --status-all 2>&1 | grep git
service --status-all 2>&1 | more