Skip to content

Commit

Permalink
fix permission 0 err, use 0644 for temporary
Browse files Browse the repository at this point in the history
  • Loading branch information
longalong committed Nov 8, 2022
1 parent 6e9a345 commit 0b43e0c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions scp.go
Original file line number Diff line number Diff line change
@@ -123,8 +123,6 @@ func CopyFromLocal(ctx context.Context, s *ssh.Session, localPath string, remote
f, _ := os.Open(localPath)
defer f.Close()

permissions := fmt.Sprintf("%04d", info.Mode())

stdout, err := s.StdoutPipe()
if err != nil {
return errors.Wrap(err, "get stdout pipe fail")
@@ -145,7 +143,7 @@ func CopyFromLocal(ctx context.Context, s *ssh.Session, localPath string, remote

defer w.Close()

_, err = fmt.Fprintln(w, "C"+permissions, info.Size(), filepath.Base(remotePath))
_, err = fmt.Fprintln(w, "C0644", info.Size(), filepath.Base(remotePath))
if err != nil {
errCh <- errors.Wrap(err, "write command fail")
return

0 comments on commit 0b43e0c

Please # to comment.