Permission Denied on Updates

Advertisement

gpin
Guest

Permission Denied on Updates

When trying to update files I get "Permission denied" error even though file and parent directories are group write (rw-rw-r--). I am in the group for those files I'm trying to update but not the owner. I can overwrite the file in an SSH session or via command line SCP so server permissions are setup fine. My workaround, while using WinSCP, is to delete the file then upload it again.

Client: XP SP2 / WinSCP 3.7.1 (B 257) in Explorer-like view; Upload set permissions to (rw-rw-r) w/ add X to directories; / Putty 0.56

Server: SSH protocol 2, OpenSSH_3.1p1, Encryption: aes, compression no; protocol SFTP(v3) - Server does not support any SFTP extension.

Not sure if this is a misconfiguration or a bug in WinSCP. In previous versions we didn't have this problem (don't know which version that was though). If anyone has suggestions or something they want me to verify let me know.

Also, I use WinSCP everyday and it's an excellent product. Thanks for the hard work prikryl.

----- START Protocol: SFTP (with SCP fallback) Logging -----
Copying 1 files/directories to remote directory "/opt/htdocs"
PrTime: Yes; PrRO: Yes; Rght: rw-rw-r--; PrR: Yes; FnCs: N; RIC: Yes; Resume: S (102400); CalcS: Yes; Mask: *.*
TM: M; ClAr: No; ExclM:
AscM: *.*html; *.htm; *.txt; *.php*; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
File: "\\<server>\<myfile>.pdf"
Copying "\\<server>\<myfile>.pdf" to remote directory started.
Binary transfer mode selected.
Opening remote file.
Type: SSH_FXP_OPEN, Size: 116, Number: 65283
Type: SSH_FXP_STATUS, Size: 24, Number: 65283
Status/error code: 4, Message: 65283, Server: Failure, Language:
Type: SSH_FXP_LSTAT, Size: 100, Number: 65543
Type: SSH_FXP_ATTRS, Size: 37, Number: 65543
Asking user:
Remote file '<myfile>.pdf' already exists. Overwrite?

New: 53725 bytes, 11/9/2004 5:18:12 PM
Existing: 53725 bytes, 11/10/2004 8:51:00 AM ()
Type: SSH_FXP_OPEN, Size: 116, Number: 65795
Type: SSH_FXP_HANDLE, Size: 13, Number: 65795
Type: SSH_FXP_WRITE, Size: 4121, Number: 66054
27 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
Type: SSH_FXP_CLOSE, Size: 13, Number: 69636
Type: SSH_FXP_STATUS, Size: 24, Number: 69636
Status/error code: 0
Type: SSH_FXP_SETSTAT, Size: 116, Number: 69897
Type: SSH_FXP_STATUS, Size: 34, Number: 69897
Status/error code: 3, Message: 69897, Server: Permission denied, Language:
(ETerminal) Permission denied.
Error code: 3
Error message from server: Permission denied
Request code: 9
Asking user:
Upload of file '<myfile>.pdf' was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn off 'Set permissions' and/or 'Preserve timestamp' option. ("Permission denied.
Error code: 3
Error message from server: Permission denied
Request code: 9")
(EScpSkipFile) Upload of file '<myfile>.pdf' was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn off 'Set permissions' and/or 'Preserve timestamp' option.
Permission denied.
Error code: 3
Error message from server: Permission denied
Request code: 9
Listing directory "\\<server>\<path>".
Type: SSH_FXP_OPENDIR, Size: 82, Number: 70155
Type: SSH_FXP_HANDLE, Size: 13, Number: 70155
Type: SSH_FXP_READDIR, Size: 13, Number: 70412
Type: SSH_FXP_NAME, Size: 1057, Number: 70412
Type: SSH_FXP_READDIR, Size: 13, Number: 70668
Type: SSH_FXP_STATUS, Size: 28, Number: 70668
Status/error code: 1
Type: SSH_FXP_CLOSE, Size: 13, Number: 70916
Type: SSH_FXP_STATUS, Size: 24, Number: 70916
Status/error code: 0
----- END Protocol: SFTP (with SCP fallback) Logging -----



----- START Protocol: SCP (only) Logging -----
Copying 1 files/directories to remote directory "/opt/htdocs/"
PrTime: Yes; PrRO: Yes; Rght: rw-rw-r--; PrR: Yes; FnCs: N; RIC: Yes; Resume: S (102400); CalcS: Yes; Mask: *.*
TM: M; ClAr: No; ExclM:
AscM: *.*html; *.htm; *.txt; *.php*; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
echo "WinSCP: this is begin-of-file" ; scp -r -p -d -t "/opt/htdocs/" ; echo "WinSCP: this is end-of-file:$?"
WinSCP: this is begin-of-file
SCP remote side confirmation (0)
Asking user:
Remote file '<myfile>.pdf' already exists. Overwrite?

New: 212304 bytes, 5/4/2004 8:50:02 AM
Existing: 212304 bytes, 5/4/2004 1:22:07 PM ()
File: "\\<myserver>\<myfile>.pdf"
Copying "\\<myserver>\<myfile>.pdf" to remote directory started.
Binary transfer mode selected.
T1083682202 0 1095778325 0
SCP remote side confirmation (0)
C0664 212304 <myfile>.pdf
SCP remote side confirmation (0)
Sending BINARY data (first block)
Sending NULL.
scp: /opt/htdocs/<myfile>.pdf: set mode: Operation not permitted
SCP remote side error (1):
Asking user:
Copying file '\\<myserver>\<myfile>.pdf' failed. ("scp: /opt/htdocs/<myfile>.pdf: set mode: Operation not permitted")
(EScpFileSkipped) scp: /opt/htdocs/<myfile>.pdf: set mode: Operation not permitted
E
scp: /opt/htdocs/<myfile>.pdf: set times: Operation not permitted
SCP remote side error (1):
(EScpFileSkipped) scp: /opt/htdocs/<myfile>.pdf: set times: Operation not permitted
Listing current directory.
ls -la --full-time ; echo "WinSCP: this is end-of-file:$?"
(ECommand) Error listing directory '/opt/htdocs/'.
Unexpected directory listing line '
Invalid rights description ''
----- END Protocol: SCP (only) Logging -----

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Permission Denied on Updates

You get the "Permission denied" because you are tring to modify file permissions while you are probably not owner of the file. If you read the error message carefoully you would see a reason and solution :-)

Reply with quote

gpin
Guest

Correct, I am not the owner of the file but belong to the group that owns the file. The file is group+writeable which means I should be able to overwrite the file. I CAN overwrite the file when not using WinSCP such as via ssh command line or scp so server permissions are setup correctly. When using WinSCP I get the errors posted above. Seems to me it's a problem with how WinSCP determines group permissions or I have something configured wrong in WinSCP.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Ok, second attempt to explain.

Upload of file '<myfile>.pdf' was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn off 'Set permissions' and/or 'Preserve timestamp' option.
The message says that the file WAS OVERWRITTEN. So you can do this as with other clients. What has failed was attempt to change file attributes. You have checked both "Set permissions" and "Preserve timestamp". These two options does not work when you are not owner of the file. Uncheck them.

In fact I have just wrote you again what the error message says. I hope it is clear this time.

Reply with quote

Guest

martin wrote:

The message says that the file WAS OVERWRITTEN. So you can do this as with other clients. What has failed was attempt to change file attributes. You have checked both "Set permissions" and "Preserve timestamp". These two options does not work when you are not owner of the file. Uncheck them.

How do you disable these options in script/batch mode?

I have a perl script that calls winscp3, but this error message causes it to hang.

I tried looking in the help file, but permisison/time stamps arent listed in "options"

Thanks!

Reply with quote

Advertisement

martin
Site Admin
martin avatar

How do you disable these options in script/batch mode?
It is not possible yet. You may disable the options permanently in GUI preferences first. The script will use the preferred options.

Reply with quote

Guest

martin wrote:

How do you disable these options in script/batch mode?
It is not possible yet. You may disable the options permanently in GUI preferences first. The script will use the preferred options.

Thanks -

I realized that my problem was an ID 10 T error: I had read that the option "batch On" automatically replied negatively to any prompt, but I didnt realize that "Confirm Off" superceded this, and allowed get/puts.

Thanks!

Once again, WinSCP really is an awesome tool!

Reply with quote

Mike The KID
Guest

Timestamp and Permissions unchecked, error still there

You have checked both "Set permissions" and "Preserve timestamp". These two options does not work when you are not owner of the file. Uncheck them.

I'm having the same problem and went in to the transfer settings and unchecked the permissions and the timestamp but I still get the same permission denied error. What now?

Reply with quote

Mike The KID
Guest

Re: Timestamp and Permissions unchecked, error still there

Mike The KID wrote:

You have checked both "Set permissions" and "Preserve timestamp". These two options does not work when you are not owner of the file. Uncheck them.

I'm having the same problem and went in to the transfer settings and unchecked the permissions and the timestamp but I still get the same permission denied error. What now?

Nevermind. I was only unchecking the timestamp and permissions on the Transfers->Presests options, once I just unchecked them on the main Transfers menu it worked.

Reply with quote

Advertisement

vinayak
Guest

install scp if ur VM/Linux doesnt have

sudo apt install openssh-server

give write permission to /etc/ssh/sshd_config file

add a line in it

PermitRootLogin yes

After that restart your winSCP , problem will be solved. If again permission denied comes, from the login window select advanced opetions and in scp section select shell as sudo su -

Reply with quote

Advertisement

You can post new topics in this forum