8000 Permission denied with .put() · Issue #173 · jbardin/scp.py · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Permission denied with .put() #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ElieTaillard opened this issue Mar 27, 2022 · 10 comments
Open

Permission denied with .put() #173

ElieTaillard opened this issue Mar 27, 2022 · 10 comments
Labels

Comments

@ElieTaillard
Copy link
ElieTaillard commented Mar 27, 2022

I'm getting an exception with the function .put()
scp.put(files=localPath,remote_path=remotePath,recursive=True)

  • localPath = 'C:\\Users\\taill\\AppData\\Local\\Temp\\tmpycfisven\\Version1.1\\builtapp'
  • remotePath = '/var/www/projet41_new'

image

I checked to see if I had the writing rights and I do. I can transfer files with WinSCP but with the put() function it doesn't work.
I also tried to do a file transfer from a linux machine to my target machine (linux), with the scp command. And it works.
I tried to run the script from a linux machine and I get the same error.
As you can see I'm trying to scp from a temporary folder, I tried with a normal folder and it doesn't work
I checked and the temporary folder does exist.
Does anyone have a solution to the problem?

This is the part of my script where I'm using scp :

p = paramiko.SSHClient()
p.load_system_host_keys()
p.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print("Entrez le mot de passe pour l'utilisateur '" + VMWEB1_PROD_USERNAME + "'")
passwordVm = input()
p.connect(VMWEB1_PROD_IP, username=VMWEB1_PROD_USERNAME, password=passwordVm)
scp = SCPClient(ssh.get_transport())
remotePath = os.path.join(VMWEB1_PROD_DIRECTORY,VMWEB1_PROD_PROJECT_NAME + "_new")
localPath = os.path.join(temp_dir_output.name,versionName,BUILT_APP_FOLDER_NAME)
print("Upload du dossier built vers la VM WEB 1")
scp.put(files=localPath,remote_path=remotePath,recursive=True)
@remram44
Copy link
Collaborator

Can you post the full error please?

@ElieTaillard
Copy link
Author
ElieTaillard commented Mar 27, 2022

On my windows pc :

Traceback (most recent call last):
  File "AutoDeploy.py", line 92, in <module>
    scp.put(files=localPath,remote_path=remotePath,recursive=True)
  File "C:\Users\taill\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\scp.py", line 199, in put
    self._send_recursive(files)
  File "C:\Users\taill\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\scp.py", line 367, in _send_recursive
    self._chdir(last_dir, asbytes(root))
  File "C:\Users\taill\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\scp.py", line 355, in _chdir
    self._send_pushd(to_dir)
  File "C:\Users\taill\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\scp.py", line 381, in _send_pushd
    self._recv_confirm()
  File "C:\Users\taill\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\scp.py", line 404, in _recv_confirm
    raise SCPException(
8000
asunicode(msg[1:]))
scp.SCPException: scp: /var/www/projet41_new: Permission denied

On my linux test machine :
image

@ElieTaillard
Copy link
Author

I feel like I've tried everything...
I will try to do with os.system('scp') for now.
We'll see if it works.

@remram44
Copy link
Collaborator

Looks like you don't have permission to go into that folder. I don't think there is a bug in scp.py.

@ElieTaillard
Copy link
Author

I do have write permissions on /var/www
Should the remote path point to an existing folder, or will the function create the folder I specify (project41_new) ?

@remram44
Copy link
Collaborator

What is the exact mode of the folder?

@ElieTaillard
Copy link
Author
ElieTaillard commented Mar 28, 2022

I tried chmod 777 on /var/www and it still doesn't work.
It's weird because with the scp command it works

@remram44
Copy link
Collaborator

Does the mode on /, /var, or /var/www not include the r or x bit?

@ElieTaillard
Copy link
Author

image
image
image

@ElieTaillard
Copy link
Author

SCP works with the instruction : os.system("scp -r " + localPath + " " + VMWEB1_PROD_USERNAME + "@" + VMWEB1_PROD_IP + ":" + remotePath)

@remram44 remram44 added the bug label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
0