Skip to content

Instantly share code, notes, and snippets.

@GitSumito
Last active January 26, 2018 06:17
Show Gist options
  • Save GitSumito/bc8d6c52bb5e282814fb5795df5a598e to your computer and use it in GitHub Desktop.
Save GitSumito/bc8d6c52bb5e282814fb5795df5a598e to your computer and use it in GitHub Desktop.
scpでPermission deniedになるファイルを無理やり転送する ref: https://qiita.com/S-T/items/fc9f34da43d6e80ad501
$ scp TargetServer:/tmp/sample /tmp/sample
scp: /tmp/sample: Permission denied
$
$ ssh TargetServer "sudo cat /tmp/sample" > /tmp/sample
$
$ ssh TargetServer "sudo dd if=/tmp/sample" | dd of=/tmp/sample
0+0 レコード入力
0+0 レコード出力
0 バイト (0 B) コピーされました、 3.3649e-05 秒、 0.0 kB/秒
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.212011 s, 0.0 kB/s
$
ssh TargetServer "cat $remoteFilename" | sudo diff - $filename
$ ssh TargetServer "cat /etc/logrotate.d/test" | diff - /tmp/test
6,8d5
< #added
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment