Problem specification
When I am working on a project, the Permission Denied prompt will appear when I upload a file to the Linux server using WinSCP, with an error return code of 3. The error figure is as follows:
As you can see from the above error, the file upload failed because of insufficient permissions, because we connected to the server as a normal user, so the solution is to connect to the server as root user, so you have the right to upload files, so how to connect to the server as root user?Let’s take a look!
The solution
1. Check the path of SFTP service on your server
On the server using the command: cat/etc/SSH/sshd_config | grep SFTP
my server output: Subsystem SFTP/usr/libexec/openssh/SFTP server. –
2. Set the connection in winSCP
Set up your host name, port, user name and password. If you log in with a key instead of a password, you do not need to fill in the password. Then click Advanced and click SFTP, and the following interface will appear:
Pictured above Settings SFTP, only need to fill in the SFTP server with sudo/usr/libexec/openssh/SFTP server, sudo the back of the class capacity is the first step we by running the cat/etc/SSH/sshd_config | grep SFTP SFTP service path. After filling in the SFTP server, click shell and the following interface appears:
As shown in the figure above, you can set the shell by filling in sudo-I in the shell. If you are using the key to log in, then you need to click the verification under SSH, and the following interface appears:
Then select the key file. Click OK, click log in and connect to the server. At this point, we connect to the server as root. At this point, we can upload files normally.
Read More:
- [Linux] solution: SCP different server copy file prompt permission denied, please try again
- Centos Failed to Modify the port of SSH: error: Bind to port 27615 on 0.0.0.0 failed: Permission denied.
- move_uploaded_file() failed to open stream: Permission denied
- Permission denied error: unable to index file .vs/Trip2015/v15/Server/sqlite3/db.lock fatal: adding
- Ng Zorro antd file stream upload, access to upload file path
- Android has applied for permission and still prompts open failed: eacces (permission denied)
- Local can link to the server database, upload jar package to the server will report an error
- GitHub desktop upload file error commit failed – exit code 1 received
- Mac realizes file interaction (upload and download) between terminal and server
- Solve the problem of dynamically applying for permission, but still reporting an error of open failed: eacces (permission denied)
- session_ start(): open(SESSION_ FILE, O_ Rdwr)) failed: processing of permission denied (13)
- Solution to permission denied
- Git error: no permission remote: error: unable to unlink old ‘ README.md ‘ (Permission denied)
- Vs_ Code remote SFTP connects to the server to modify the nginx configuration information and reports all configured authentication methods failed
- Permission error: [errno 13] permission denied: ‘… ” xxx.pyd ‘
- Monkey stress test (4)-adb opendir failed, Permission denied solution
- SQL Server import MDF and LDF files appear: unable to open physical file “D:\ XX.mdf “。 Operating system error 5: “5 (access denied. )”Solutions
- failed (13: Permission denied) while reading upstream [How to Solve]
- ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied
- PHP error Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error: