Winscp permission denied error code 3

WinSCP is a free SFTP, SCP, Amazon S3, WebDAV, and FTP client for Windows.
  • Log in

Advertisement

guest

Guest

2007-09-26 00:43

Can anyone point me in the right direction to solve my problem?

When I try to transfer a file I get the following error:

Permission denied

Error Code: 3

Error message from server: Permission denied

Request Code: 3

Advertisement

dlaws

Guest

2007-09-27 18:37

I have the same problem as what you are facing and i don’t know what to do.

I found the post below and it seemed to have worked for the guy asking the question, it may work for you? I’ve not had any luck with it, please let me know if you crack it.

<invalid hyperlink removed by admin>

Regards

d

gate4Win
Joined:
2007-09-28
Posts:
2
Location:
Gate — Riviere-du-Loup, Quebec (Canada)

2007-09-28 01:46

Just follow the each step and you will get it fixed:

1) Open WinSCP

2) Bottom-left —> put a check on Advanced options

3) Bottom of white window (Just above Advanced options) —> Left click on Preferences

4) Now move to your right in line 2/3 of the way —> Left click on the Preferences «Radio-type» Button

5) Now in the «Confirmations» box, 4th item from the top, Transfer resuming remove the ‘check-mark’

6) Left-click on the OK Button ——> You’re done ! Enjoy it

jga

gate4Win
Joined:
2007-09-28
Posts:
2
Location:
Gate — Riviere-du-Loup, Quebec (Canada)

2007-09-28 04:12

DLAWS: Please forget about the previous reply (Posted: 28 Sep 2007 05:46).

The problem is with permission security of your server. (My server —> FreeBSD 6.2)

The only way I could sign-in and transfer/delete/etc.. files from/to my PC was to give «root» permission to login through SSH login. (Have to set PermitRootLogin yes) in sshd_config file.

No more «Permission denied — error code 3».

Gate

martin◆

Site Admin
martin avatar
Joined:
2002-12-10
Posts:
38,466
Location:
Prague, Czechia

2007-10-02

Can anyone point me in the right direction to solve my problem?

When I try to transfer a file I get the following error:

Please post a main error message too.

Advertisement

acnow2

Guest

2014-08-17 07:54

I am using winscp to access my aws instance. I followed all the steps https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html#putty-private-key and I was able to connect but when I am going to edit any directory it gives me this error

Permission denied.

Error code: 3

Error message from server: Permission denied

Any idea why is doing that? Thanks in advance! Al

martin◆

Site Admin
martin avatar
Joined:
2002-12-10
Posts:
38,466
Location:
Prague, Czechia

2014-08-18

acnow2 wrote:

I am using winscp to access my aws instance. I followed all the steps https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html#putty-private-key and I was able to connect but when I am going to edit any directory it gives me this error

Duplicate post:

https://winscp.net/forum/viewtopic.php?t=14235

dceddy
Joined:
2014-08-29
Posts:
1

2014-08-29 15:47

I’m having a similar problem to the prior report as shown on this attachment with no Request Code shown on the error message. I try to upload one file with no problem, but have this problem only on a new file as shown. both of these files are the same for permissions settings. I tried several times in case of any file corruption, but had the same issue every time.

Does anybody have any suggestions that we should try when this problem occurs?

martin◆

Site Admin
martin avatar
Joined:
2002-12-10
Posts:
38,466
Location:
Prague, Czechia

2014-09-03

dceddy wrote:

I’m having a similar problem to the prior report as shown on this attachment with no Request Code shown on the error message. I try to upload one file with no problem, but have this problem only on a new file as shown. both of these files are the same for permissions settings. I tried several times in case of any file corruption, but had the same issue every time.

So do both files exist in the remote directory, with the same permissions? Or does the first file exist only and the second one (the one your get the error with) is new?

Advertisement

Guest

2014-09-03 14:54

Both files do exist in the same root directory with the same permissions. One is old and one is new. But, I try to upload both to the same directory. The old one does upload to the server and overwrites the old existing file on the server, and the new one will not and has the error message. It is possible that the administrator of the webserver has recently changed something, and I will follow up on that, but I would like to have some idea of what could cause that.

Guest

2015-02-04 11:42

We’re having a similar problem. We can rename, delete and create. But when we overwrite, it seems to upload OK but we get error 3 saying upload «was successful, but error occurred while setting the permissions and/or timestamp»

The suggestion is to «turn off setting permissions or preserving timestamp» or we can «ignore permission errors»

Not sure what the best option is and the impact of each.

Permissions are fine, and the problem still occurs if we CHMOD 777. We can overwrite file just fine using the same user in FlashFXP.

audit.log and secure log are all green, no problems.

Running WinSCP Version 5.5.4. (Build 4433)

Server : Centos release 6.5 (Final)

martin◆

Site Admin
martin avatar
Joined:
2002-12-10
Posts:
38,466
Location:
Prague, Czechia

2015-02-09

Anonymous wrote:

We’re having a similar problem. We can rename, delete and create. But when we overwrite, it seems to upload OK but we get error 3 saying upload «was successful, but error occurred while setting the permissions and/or timestamp»

The suggestion is to «turn off setting permissions or preserving timestamp» or we can «ignore permission errors»

Not sure what the best option is and the impact of each.

Permissions are fine, and the problem still occurs if we CHMOD 777. We can overwrite file just fine using the same user in FlashFXP.

Please attach a full log file showing the problem (using the latest version of WinSCP).

To generate log file, enable logging, log in to your server and do the operation and only the operation that causes the error. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

marty

Guest

2015-06-08 13:48

I could successfully transfer to HTML Document Root (/var/www/html owned by www-data) but

not to /usr/local/bin owned by root. Error code 3.

I was in www-data’s group, but not in root. Added myself to root’s group with 775 permission.

(DUH. What took me so long? Maybe we’re ALL too busy lol.)

Advertisement

shamnas

Guest

2015-08-06 16:14

ssh to your server using putty or whatever..

chmod 777 <directory name>

and copy whatever you like

change the permissions back…

Balaam

Guest

2015-08-26 07:27

Because you dont have the right. -rwx r—

benjamin

Guest

2016-03-01 18:02

i had the same message. It happens because my sftp server was full. I have solved my problem by removing files on my sftp server.

ngocht

Guest

2016-09-01 04:44

I had the same problems. But i login by my personal account. So i try again by root account and it work :D

Advertisement

IC

Guest

2016-12-07 06:41

try sudo chmod 777 /Directory-name in putty or tiger vNC

it worked for me

Guest

2016-12-31 14:05

sudo chown -R -v ec2-user /var/www/ or sudo chown -R -v ubuntu /var/www/

CharlieL2017

Guest

2017-01-18 11:38

Hey Everyone our problem clearly is the same as other’s on this site we bought a lapLeah Age 6 top from Dell ad it keep’s Error: Permission to read and write N:Temp fix remote folder to continue something on the lines of this How can we fix this problem without a operating system or Windows 10 please let me our email is charlielapoite@gmail.com I Miss my good laptop we are using our shitty slow one lol Please help

brockayers

Guest

2017-02-07 18:42

Hello, Im fairly new to Raspberry Pi, programming, and all this stuff.

I’m trying to copy a file from my Rpi to my computer via WINSCP. When I try to open the folder with the file in it, I get:

Permission denied.

Error code: 3

Error message from server: Permission denied

Could someone explain what I need to do to get permission??

Advertisement

martin◆

Site Admin
martin avatar
Joined:
2002-12-10
Posts:
38,466
Location:
Prague, Czechia

2017-02-09

brockayers wrote:

Hello, Im fairly new to Raspberry Pi, programming, and all this stuff.

I’m trying to copy a file from my Rpi to my computer via WINSCP. When I try to open the folder with the file in it, I get:…

Same answer: Start a new post and post a log file or at least a complete error message. Explain what do you mean by «open the folder with the file».

Guest

2017-03-09 06:35

You should give all permission to that pertcular user in sudoers file and u have to give 777 permission to the folder to which you trying to copy the file.

6thPlaneta

Guest

2017-07-10 09:27

shamnas wrote:

ssh to your server using putty or whatever..

chmod 777 <directory name>

and copy whatever you like

change the permissions back…

It’s true.

for safety you can chmod 775 like this:

sudo chmod 775 /YOUR_DIRECTORY

FUM

Guest

2017-10-01 15:43

How the error occurred in my case was during a file transfer. I was wondering if I could transfer a file between two separate ftp sessions inside WinSCP.

How I resolved the file permission Error:

1- I renewed the session, where I got the permission Error, by pressing the button with the two opposing green arrows inside a folder icon (Refresh, Ctrl+R).

(Not sure if it made any difference but that is what I did).

2- Then I clicked on the folder icon where a downward green arrow is (Open directory/bookmark, Ctrl+O), which brought up the file path.

3- I selected the file path where I have my domains.

4- Clicked OK

Suddenly it worked again.

Advertisement

Hari Prasad Sala

Guest

2018-01-02 05:59

Please make sure that the folder in AWS Instance has required permissions.

That can be done by following command:

chmod 777 folder_name

Hope this helps…

vela

Guest

2018-04-18 02:28

I had a similar issue and was getting error code 3. Come to find out, my first «get» was actually removing the file from the SFTP and when I did my second call to the file, there was no file therefore throwing an error. To fix, I did the «get» then a copy from the target.

kenny117

Guest

2018-06-13 21:20

I got the same error but what I did is that I passed the folder/file to the home directory(destination) then after that I used Putty to connect to that server and then I do a copy command to copied the folder to the specified location.

BrentBR
Joined:
2018-07-15
Posts:
3
Location:
London, Canada

2018-07-15 16:46

I’m running WinSCP 5.13.3

I have a script…

cd "C:Program Files (x86)WinSCP"
# WinSCP.com
# open "brassroots"
WinSCP.exe "brassroots" /defaults /synchronize // "C:websitesbrassrootswww" "/public"

My symptom is *intermittent*. I’m working with my isp but no resolution yet.

*SOMETIMES* WinSCP fails to copy a changed file to the server.

«Synchronize» recognizes the change. Manual file copy also fails. Diagnostic is:

Permission denied; Error code: 3; Error message from server (en-US): Permission denied

However, when a copy fails, I can still delete the file on the server and replace it!

This seems bizarre to me. How is it that with WinSCP if I cannot copy/replace a file, I can still delete/replace it? That is my puzzle. But the problem is intermittent.

My skill set is «kick it and see if it twitches». :-) I’ve boiled the issue down to this.

If you wizards can provide any insight I would really appreciate it.

Advertisement

martin◆

Site Admin
martin avatar
Joined:
2002-12-10
Posts:
38,466
Location:
Prague, Czechia

2018-07-21

BrentBR wrote:

Manual file copy also fails. Diagnostic is:

Permission denied; Error code: 3; Error message from server (en-US): Permission denied

However, when a copy fails, I can still delete the file on the server and replace it!

Delete and overwrite permissions are separate on most servers.

For example on *nix servers, to overwrite a file, you need write permissions to the file. But to delete a file, you need write permissions to a parent folder, and you do not need write permissions to the file.

BrentBR
Joined:
2018-07-15
Posts:
3
Location:
London, Canada

2018-07-21 21:35

Martin, thank you.

All files are rw-r—r—. Directory is rwxr-xr—

Directory owner shows 36466 (whatever that means). File ownership shows 14 (also ???).

SOMETIMES file copy/replace works. Sometimes it fails. If it fails and I retry (restart WinSCP) it works often (often enough that I can live with it). But obviously I’d rather figure this out!

My isp wants me to switch over to «SSH» (whatever that is) using port 22. Currently I use port 21. But I’m not convinced that will fix anything, especially if the problem is intermittent and apparently related to permissions.

Any further ideas? Is there anything I can do that might figure out why this happens, but only sometimes? Thank you again.

martin◆

Site Admin
martin avatar

2018-07-25

Whatever the problem is, it’s unlike that it’s client-side problem.

Switching to SSH (actually to SFTP) is good idea in any case. So if your ISP suggests that, try it.

BrentBR
Joined:
2018-07-15
Posts:
3
Location:
London, Canada

2018-08-10 18:57

I still have no resolution. However I’ve observed the following that seems to be consistent.

When I login to the server with WinSCP the login sometimes is very *fast* (almost instantaneous). Other times the login is fairly *slow*. Almost sluggish. «Slow» is often accompanied with initial connection failure, timeout, then connection success.

When login is fast/instant file copying fails! If the login is sluggish, it almost always works! This seems really bizarre to me but it is very consistent!

Something else has occurred to me (though this my be a red herring). Things worked fine on my old laptop but started failing with my new laptop which my son set up with an SSD. I can’t see how this could possibly cause a problem, but might «instant» logins be associated with my SSD somehow? Like some sort of caching happening? (I don’t believe in this association but I throw it out for you to trample.)

I’m still getting by, but occasionally get the urge to beat this dead horse some more. Thank you for putting up with this intermittent and apparently bizarre problem.

Advertisement

manisha sona

Guest

2018-09-19 20:55

Of all the ways you can do this:

on your remote (Winscp), go to home directory. you can see a house icon beside refresh icon.

copy the folder from your local host (on left) to remote host (on right side). In this way the content will be copied from your local to remote (Home).

now, open the putty and ssh to remote machine.

use this command

cp -r /home/ec2-user/yourfoldernamewhichyoucopiedfromlocaltohome /desiredlocationonroot/

Example: I have folder called Manisha.txt and I want to copy that to sona directory which is located in /opt/ (/root/opt/sona)

cp -r /home/ec2-user/Manisha.txt /opt/sona

Thanks it!

it works.

Guest

2018-09-26 20:47

guest wrote:

Can anyone point me in the right direction to solve my problem?

When I try to transfer a file I get the following error:

Permission denied

Error Code: 3

Error message from server: Permission denied

Request Code: 3

Solution:

1. Open winscp

2. Start New Session -> Advanced ->Shell

3. Where it says Default, Change that to sudo su-

See attached below

Gayatri

Guest

2018-10-17 05:49

sudo chmod -R 777 <Directoryname>

It will reduce permission denied problem.

Advertisement

  • Log in

This topic is locked: you cannot edit posts or make replies

Для удобства работы с удаленными Linux серверами и обычными машинами многие начинающие пользователи использую программу WinSCP. Она и вправду очень удобная и простая в использование в отличии например от PuTTY, напоминает обычный проводник Windows. Но важно понимать что WinSCP это клиент который предназначен для копирования файлов, конечно с его помощью можно настраивать config и изменять другие файлы. Но выполнить какую либо команду не получиться, например, запустить службу или установить её. Для этих целей придется обратиться к PuTTY. Сегодня рассмотрим ошибку «Доступ запрещен, код ошибки 3» которая может появиться во время каких либо действий с файлами, копирования, перемещения, изменения и т.д. Говорит это о том что у Вас не хватает прав, но давайте обо всем по порядку.

Что делать если во время работы с файлом появляется ошибка «Не могу заново открыть файл ‘/»

И так Вы работаете с фалами на удаленном сервере через клиента WinSCP, Вам потребовалось скажем скачать (переместить, изменить, переименовать и т.д.) это файл к себе на компьютер.

Скачать WinSCP — https://winscp.net/eng/download.php

Что делать если во время работы с файлом появляется ошибка "Не могу заново открыть файл '/"

Вы как обычно кликаете ПКМ мыши и выбираете «Получить» но видите сообщение об ошибке следующего вида.

Ошибка

Не могу заново открыть файл «/…/»

Доступ запрещен.

Код ошибки: 3

Сообщение ошибки от сервера: Permission denied (В разрешении отказано)

WinSCP доступ запрещён код ошибки 3

Все это говорит о том что у Вас просто напросто не прав на изменение этого файла. Определить это можно если посмотреть на колонку «Права», в данном случае видим что чтение и запись разрешены только владельцу файла «root». Для работы с файлами под обычным пользователям права должны выглядеть в этой колонке как и папки выше.

Что делать если во время работы с файлом появляется ошибка "Не могу заново открыть файл '/"

Можно определенному пользователю дать права «root» изменив настройки sftp сервера. Данный способ описан практически в каждой статье которую вы найдете в поиске. Но в этом случае обычный пользователь сможет удалять изменять системный файлы и файлы конфигурации. В результате можно положить сервер.

В нашем же случае гораздо проще изменить права необходимого файла. Для этого придется воспользоваться программой PuTTY.

Скачать PuTTY — https://www.putty.org/

Скачиваем и запускаем программу, для подключения вводим ip адрес удаленного сервера.

PuTTY  подключение к серверу

В открывшемся окне сначала авторизуемся под обычным пользователем, потом с помощью команды «su» получаем «root» права, и запускаем файловый менеджер «mc».

PuTTY авторизация

Находим необходимый файл, выделяем его и на панели инструментов открываем раздел «Файл» и выбираем пункт «Права доступа».

Файловый менеджер MC изменение прав доступа

В открывшемся окне отмечаем пункты, если есть группы отмечаем «Чтение для групп»,» Запись для групп», если групп нет тогда «Чтение для других» и «Запись для других» либо можете отметить и то и то.

Права доступа на файл

После этого необходимо переподключиться к удаленной машине в клиенте WinSCP.

WinSCP доступ запрещён ошибка "Не могу заново открыть файл '/"

После этого все возможные действия (копирование, перемещение, изменение и т.д.) с фалом должны быть доступны.

by Afam Onyimadu

Afam is a geek and the go-to among his peers for computer solutions. He has a wealth of experience with Windows operating systems, dating back to his introduction… read more


Published on June 16, 2022

  • The permission denied error message is often caused with you try transferring or copying files without the proper access privileges. 
  • Tiny typo errors in location addresses are enough to cause this error on a server request. 
  • If global read/write settings are changed, they should be revoked as soon as the file transfer is over. 

In this article, we discuss the error permission denied. error code: 3 error message from server: permission denied

Error codes on computers or computing processes can be frustrating. In many instances, it implies that your operations are halted, and you will no longer be able to execute specific tasks. Unfortunately, the permission denied error code 3 is not an exception.

In this article, we dive into this error and recommend what to do when it comes up. Note that Windows users may face a similar problem of no access to the server.

Without much ado, let’s jump into it.

What does it mean when it says permission denied?

Firstly, let’s point out that you should be mindful of a few variations to this error. You may get either of the following:

  • Permission denied. error code 3
  • SFTP error 3 permission denied
  • WinSCP network error: permission denied
  • Error message from server: permission denied

Whichever is the case, it most likely means that you do not have adequate rights to access or transfer a directory or file.

In the case of the SFTP variant, you can usually access the SFTP server via SSH, but you will not be able to make changes to a specific directory or file.

Generally, you will get this error while transferring or copying files from a local system to a remote host.

How do I fix the denied permissions error?

1. Confirm the password and username

Since this error is often caused because you do not have the proper access rights to a file, it could mean you are using the wrong credentials. Therefore, you should check your username and password and ensure they are the credentials with the proper rights to access the file.

2. Change file permission to read/write

  1. Type in this code to give read permission:
    sudo chmod -R 755 /remote-dir/
    permission denied. error code: 3 error message from server: permission denied
  2. Type in this code to give write permission:
    sudo chmod -R 777 /remote-dir/
    permission denied. error code: 3 error message from server: permission denied
  3. Try the file copy or transfer again and see if you have the permission denied error message.

Changing the file permission to RXW for everyone could pose a security risk. Hence, if this is your adopted method, you should undo it once the transfer is completed.

Read more about this topic

  • Microsoft Edge Keeps Crashing: 4 Easy Ways to Stop That
  • Chrome Toolbar Missing: 5 Tested Ways to Get It Back
  • 6 Best Lightweight Web Browsers for Raspberry Pi

3. Confirm the remote file path

This is a rookie mistake, but not one to be ignored. You may have just typed in the wrong resource path. In this case, your access will be denied.

All you need to do is confirm the correct path and re-input it. If you still do not have access, skip to the next solution.

With any of these three fixes, you should have been able to resolve the permission denied. error code: 3 error message from server: permission denied on your server.

You mainly have to pay attention to user rights, and you will be able to avoid this issue in the future.

newsletter icon

Newsletter

The following tutorial worked for me and provides helpful screenshots. Logging in as a regular user with sudo permissions simply required tweaking a few WinSCP options:
http://cvlive.blogspot.de/2014/03/how-to-login-in-as-ssh-root-user-from.html

Set Session/File protocol to: SCP, enter host/instance ip, port — usually 22, and regular username. Enter password credentials if the login requires it.
Add the user’s corresponding Private key file in Advanced/SSH/Authentication.

Unchecking Advanced/SSH/Authentication/attempt «keyboard interactive» authentication should allow Advanced/Environment/SCP Shell/Shell/Shell: sudo su — to provide sudo permissions for accessing webserver directories as a non-owner user.


Update: 08/03/2017

WinSCP logging can be helpful to troubleshoot issues.

winscp.net/eng/docs/logging:

[WinSCP] Logging can be enabled from Logging page of Preferences dialog.
Logging can also be enabled from command-line using /log and /xmllog
parameters respectively, what is particularly useful with scripting.
In .NET assembly, session logging is enabled using
Session.SessionLogPath1).

Depending on WinSCP connection errors, some server installations may need a directive added to the (Ubunto, CentOS, other-Linux-Server) /etc/sudoers file to not require TTY for a specified user. Creating a file in /etc/sudoers.d/ (using a tool such as Amazon Command Line Interface or PuTTY) may be a better option than editing /etc/sudoers. Some /etc/sudoers versions recommend it:

This file MUST be edited with the ‘visudo’ command as root.
Please consider adding local content in /etc/sudoers.d/ instead of
directly modifying this file.
See the man page for details on how to write a sudoers file.

When editing a sudoers file (as root) through the command-line, the ‘visudo’ command should be used to open the file as it will parse the file for syntax errors. /etc/sudoers.d/ files are typically owned by root and chmoded with minimal permissions. The default /etc/sudoers file may be referenced as it should automatically have recommended chmod permissions on installation. e.g.: 0440 r—r—— .

superuser.com/a/869145 :

visudo -f /etc/sudoers.d/somefilename

Defaults:username !requiretty 

Helpful Links:

  • Stackoverflow: stackoverflow.com/questions/25688850/cloud-init-how-to-add-default-user-to-sudoers-d
    • www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos

WinSCP Forum:
— winscp.net/forum/viewtopic.php?t=3046
— winscp.net/forum/viewtopic.php?t=2109

WinSCP Doc: https://winscp.net/eng/docs/faq_su

With SCP protocol, you can specify following command as custom shell
on the SCP/Shell page of Advanced Site Settings dialog:

sudo -s

[…]

Note that as WinSCP cannot implement terminal emulation, you need to
have sudoers option requiretty turned off.

Instructions in Ubuntu Apache /etc/sudoers recommend adding directives to /etc/sudoers.d rather than editing /etc/sudoers directly. Depending on the installation, adding directive to /etc/sudoers.d/cloud-init may work as well.

It may be helpful to create an SSH test user with sudo permissions by following the steps provided in instance documentation to ensure that the user has recommended instance settings and any updates to server sudoer files can be effected and removed without affecting other users.

Понравилась статья? Поделить с друзьями:
  • Winsock error 10060 mdaemon
  • Winscp network error connection refused
  • Winsock error 10060 exchange 2013
  • Winsock error 10054 mdaemon
  • Winscp file transfer error