Re: why can't download file from linux server into local window disk c:
To: pengsir On Tue, 09 Dec 2014 00:14:15 -0800, pengsir wrote: > localpath = 'c:' > sftp.get(filepath, localpath) > with open(localpath, 'wb') as fl: > PermissionError: [Errno 13] Permission denied: 'c:' It's trying to open "c:", which is a drive, as if it was a file. You have to specify the destination filename, not just the directory. Also, you probably shouldn't be trying to write to the root directory of the C drive. You should probably be using a directory beneath either %USERPROFILE% or %ALLUSERSPROFILE%. Writing to the root of the system drive tends to require Administrator privileges. Even if the current user is an administrator, the process must have elevated privilege (e.g. via "Run as Administrator" or an explicit privilege-elevation request from within the code). --- SoupGate-Win32 v1.05 * Origin: nntp.gatew...@.piz.noip.me> (1:249/999) --- Synchronet 3.15b-Win32 NewsLink 1.92 SpaceSST BBS Usenet <> Fidonet Gateway -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:
To: Luuk Copy: python-list@python.org On 2014-12-08 19:11, Luuk wrote: > On 8-12-2014 18:37, ishish wrote: > >> with open(localpath, 'wb') as fl: > >> PermissionError: [Errno 13] Permission denied: 'c:' > > > > I remember gloomily (haven't used windows since ages) that newer > > Windows versions don't like users to write directly to C:. Have > > you tried to save the file to your Documents folder? > > > > Regards, > > Alba > > no, it's the ssh-server denying a log on from 'root' I'm going to go out on a limb and say that's pretty clearly not the issue. The exception states that the problem is one of permissions on the C: PermissionError: [Errno 13] Permission denied: 'c:' which ishish clearly identified as a "Windows doesn't let you do that any more" issue. Additionally, I don't know off the top of my if the Paramiko libraries expect a file-name, or if they expect a directory into which the file gets put based on the server-side name. The best solution is to do as ishish proposed: write the file to some other appropriate (i.e., writable) location. A simple fix might be import os # ... localpath = os.path.expanduser('~') or localpath = os.path.join( os.path.expanduser('~'), 'passwd.txt', ) A stop-gap solution might be to just run the program in a writable directory: c:\> cd %TEMP% c:\...\TEMP> python myprog.py A far worse solution would be to run the script as Administrator on the Win32 box, which will grant permission to write in the root of C: -tkc --- SoupGate-Win32 v1.05 * Origin: nntp.gatew...@.piz.noip.me> (1:249/999) --- Synchronet 3.15b-Win32 NewsLink 1.92 SpaceSST BBS Usenet <> Fidonet Gateway -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:
Am 08.12.2014 19:11 schrieb Luuk: > no, it's the ssh-server denying a log on from 'root' You are repating yourself. How could possibly with open(localpath, 'wb') as fl: PermissionError: [Errno 13] Permission denied: 'c:' be a problem with the SSH server? --- SoupGate-Win32 v1.05 * Origin: nntp.gatew...@.piz.noip.me> (1:249/999) --- Synchronet 3.15b-Win32 NewsLink 1.92 SpaceSST BBS Usenet <> Fidonet Gateway -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:
Am 09.12.2014 09:14 schrieb pengsir: > My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server > into my local window disk c: . > localpath = 'c:' [...] > with open(localpath, 'wb') as fl: > PermissionError: [Errno 13] Permission denied: 'c:' That's completely clear: you are not allowed to create a file named 'c:'. You should replace it with a full path name, such as localpath = 'c:\\passwd' or such. Thomas --- SoupGate-Win32 v1.05 * Origin: nntp.gatew...@.piz.noip.me> (1:249/999) --- Synchronet 3.15b-Win32 NewsLink 1.92 SpaceSST BBS Usenet <> Fidonet Gateway -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:
To: pengsir On 2014-12-09 08:14, pengsir wrote: > > > My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server > into my local window disk c: . > > import paramiko > host = "x.y.z.w" > port = 22 > transport = paramiko.Transport((host, port)) > password = "mykey" > username = "root" > transport.connect(username = username, password = password) > sftp = paramiko.SFTPClient.from_transport(transport) > filepath = '/etc/passwd' > localpath = 'c:' > sftp.get(filepath, localpath) > > Traceback (most recent call last): > File "", line 1, in > File "D:\Python34\lib\site-packages\paramiko\sftp_client.py", line > 719, in get > > with open(localpath, 'wb') as fl: > PermissionError: [Errno 13] Permission denied: 'c:' > It's trying to open the file 'c:', but that's not a file, it's a folder. Try, say, 'c:/passwd' instead. --- SoupGate-Win32 v1.05 * Origin: nntp.gatew...@.piz.noip.me> (1:249/999) --- Synchronet 3.15b-Win32 NewsLink 1.92 SpaceSST BBS Usenet <> Fidonet Gateway -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:
To: Luuk Copy: python-list@python.org (python-list@python.org) On Tue, Dec 9, 2014 at 5:11 AM, Luuk wrote: > On 8-12-2014 18:37, ishish wrote: >>> >>> with open(localpath, 'wb') as fl: >>> PermissionError: [Errno 13] Permission denied: 'c:' >> >> >> I remember gloomily (haven't used windows since ages) that newer Windows >> versions don't like users to write directly to C:. Have you tried to >> save the file to your Documents folder? >> >> Regards, >> Alba > > > no, it's the ssh-server denying a log on from 'root' It looks to me more like an issue with path naming. Try 'c:/' instead of 'c:', or use '/' to mean the root directory of the current drive. Alternatively, do a web search for the problem and the symptoms, as you're unlikely to be the first person to have run into this. ChrisA --- SoupGate-Win32 v1.05 * Origin: nntp.gatew...@.piz.noip.me> (1:249/999) --- Synchronet 3.15b-Win32 NewsLink 1.92 SpaceSST BBS Usenet <> Fidonet Gateway -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:
To: pengsir On 9-12-2014 09:14, pengsir wrote: > > > My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server > into my local window disk c: . > > import paramiko > host = "x.y.z.w" > port = 22 > transport = paramiko.Transport((host, port)) > password = "mykey" > username = "root" > transport.connect(username = username, password = password) > sftp = paramiko.SFTPClient.from_transport(transport) > filepath = '/etc/passwd' > localpath = 'c:' > sftp.get(filepath, localpath) > > Traceback (most recent call last): >File "", line 1, in >File "D:\Python34\lib\site-packages\paramiko\sftp_client.py", line > 719, in get > > with open(localpath, 'wb') as fl: > PermissionError: [Errno 13] Permission denied: 'c:' You, 'root', does not have enoug permission to do it C:\temp>\util\Putty\pscp root@opensuse:/etc/passwd . Using keyboard-interactive authentication. Password: Access denied --- SoupGate-Win32 v1.05 * Origin: nntp.gatew...@.piz.noip.me> (1:249/999) --- Synchronet 3.15b-Win32 NewsLink 1.92 SpaceSST BBS Usenet <> Fidonet Gateway -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:
To: ishish On 8-12-2014 18:37, ishish wrote: >> with open(localpath, 'wb') as fl: >> PermissionError: [Errno 13] Permission denied: 'c:' > > I remember gloomily (haven't used windows since ages) that newer Windows > versions don't like users to write directly to C:. Have you tried to > save the file to your Documents folder? > > Regards, > Alba no, it's the ssh-server denying a log on from 'root' --- SoupGate-Win32 v1.05 * Origin: nntp.gatew...@.piz.noip.me> (1:249/999) --- Synchronet 3.15b-Win32 NewsLink 1.92 SpaceSST BBS Usenet <> Fidonet Gateway -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:
To: Tim Chase Copy: python-list@python.org (python-list@python.org) On Tue, Dec 9, 2014 at 6:50 AM, Tim Chase wrote: > Just for the record, you can enable root logins but disallow password > logins, so root has to be done with a public/private key-pair. > > That said, I do as you describe and still SSH to my ssh-user account, > then "su" to root as needed from there. But at least there's a > middle ground that isn't as vulnerable as putting a root account out > there to be banged on by any script-o-matic bot that finds it. I've done both of these. Most of my boxes don't have passwords on the root account AND don't allow SSH to root, relying on a sudo-enabled account usually; and it's perfectly possible to also deny password access to *any* account via SSH. Quite good for security... though it can create an awkward bootstrap problem if you lose all private keys that had access. ChrisA --- SoupGate-Win32 v1.05 * Origin: nntp.gatew...@.piz.noip.me> (1:249/999) --- Synchronet 3.15b-Win32 NewsLink 1.92 SpaceSST BBS Usenet <> Fidonet Gateway -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:
To: alister Copy: python-list@python.org On 2014-12-08 18:46, alister wrote: > on most systems that DO have a ssh server root logins are usually > prohibited, either enable root logins (dangerous) or log in with a > user that has permissions to do what you require. if you don't have > access to the server then you need assistance from someone who is > authorised. Just for the record, you can enable root logins but disallow password logins, so root has to be done with a public/private key-pair. That said, I do as you describe and still SSH to my ssh-user account, then "su" to root as needed from there. But at least there's a middle ground that isn't as vulnerable as putting a root account out there to be banged on by any script-o-matic bot that finds it. I also like to change my external SSH port to something non-traditional (and have configured port-knocking in the past) to prevent the obvious pokes I would otherwise see in my sshd/auth/access logs. -tkc --- SoupGate-Win32 v1.05 * Origin: nntp.gatew...@.piz.noip.me> (1:249/999) --- Synchronet 3.15b-Win32 NewsLink 1.92 SpaceSST BBS Usenet <> Fidonet Gateway -- https://mail.python.org/mailman/listinfo/python-list
why can't download file from linux server into local window disk c:?
My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server into my local window disk c: . import paramiko host = "x.y.z.w" port = 22 transport = paramiko.Transport((host, port)) password = "mykey" username = "root" transport.connect(username = username, password = password) sftp = paramiko.SFTPClient.from_transport(transport) filepath = '/etc/passwd' localpath = 'c:' sftp.get(filepath, localpath) Traceback (most recent call last): File "", line 1, in File "D:\Python34\lib\site-packages\paramiko\sftp_client.py", line 719, in get with open(localpath, 'wb') as fl: PermissionError: [Errno 13] Permission denied: 'c:' --- SoupGate-Win32 v1.05 * Origin: nntp.gatew...@.piz.noip.me> (1:249/999) --- Synchronet 3.15b-Win32 NewsLink 1.92 SpaceSST BBS Usenet <> Fidonet Gateway -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:
To: Luuk On Mon, 08 Dec 2014 19:11:40 +0100, Luuk wrote: > On 8-12-2014 18:37, ishish wrote: >>> with open(localpath, 'wb') as fl: >>> PermissionError: [Errno 13] Permission denied: 'c:' >> >> I remember gloomily (haven't used windows since ages) that newer >> Windows versions don't like users to write directly to C:. Have you >> tried to save the file to your Documents folder? >> >> Regards, >> Alba > > no, it's the ssh-server denying a log on from 'root' windows systems dont usualy have an SSH server & root is not a normal windows user name on most systems that DO have a ssh server root logins are usually prohibited, either enable root logins (dangerous) or log in with a user that has permissions to do what you require. if you don't have access to the server then you need assistance from someone who is authorised. -- Do you know Montana? --- SoupGate-Win32 v1.05 * Origin: nntp.gatew...@.piz.noip.me> (1:249/999) --- Synchronet 3.15b-Win32 NewsLink 1.92 SpaceSST BBS Usenet <> Fidonet Gateway -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:?
It's trying to open the file 'c:', but that's not a file, it's a folder. Try, say, 'c:/passwd' instead. It works for me, i tried ,it is ok . -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:?
On Tue, 09 Dec 2014 00:14:15 -0800, pengsir wrote: > localpath = 'c:' > sftp.get(filepath, localpath) > with open(localpath, 'wb') as fl: > PermissionError: [Errno 13] Permission denied: 'c:' It's trying to open "c:", which is a drive, as if it was a file. You have to specify the destination filename, not just the directory. Also, you probably shouldn't be trying to write to the root directory of the C drive. You should probably be using a directory beneath either %USERPROFILE% or %ALLUSERSPROFILE%. Writing to the root of the system drive tends to require Administrator privileges. Even if the current user is an administrator, the process must have elevated privilege (e.g. via "Run as Administrator" or an explicit privilege-elevation request from within the code). -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:?
On Tue, Dec 9, 2014 at 6:50 AM, Tim Chase wrote: > Just for the record, you can enable root logins but disallow password > logins, so root has to be done with a public/private key-pair. > > That said, I do as you describe and still SSH to my ssh-user account, > then "su" to root as needed from there. But at least there's a > middle ground that isn't as vulnerable as putting a root account out > there to be banged on by any script-o-matic bot that finds it. I've done both of these. Most of my boxes don't have passwords on the root account AND don't allow SSH to root, relying on a sudo-enabled account usually; and it's perfectly possible to also deny password access to *any* account via SSH. Quite good for security... though it can create an awkward bootstrap problem if you lose all private keys that had access. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:?
On 2014-12-08 18:46, alister wrote: > on most systems that DO have a ssh server root logins are usually > prohibited, either enable root logins (dangerous) or log in with a > user that has permissions to do what you require. if you don't have > access to the server then you need assistance from someone who is > authorised. Just for the record, you can enable root logins but disallow password logins, so root has to be done with a public/private key-pair. That said, I do as you describe and still SSH to my ssh-user account, then "su" to root as needed from there. But at least there's a middle ground that isn't as vulnerable as putting a root account out there to be banged on by any script-o-matic bot that finds it. I also like to change my external SSH port to something non-traditional (and have configured port-knocking in the past) to prevent the obvious pokes I would otherwise see in my sshd/auth/access logs. -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:?
On 2014-12-08 19:11, Luuk wrote: > On 8-12-2014 18:37, ishish wrote: > >> with open(localpath, 'wb') as fl: > >> PermissionError: [Errno 13] Permission denied: 'c:' > > > > I remember gloomily (haven't used windows since ages) that newer > > Windows versions don't like users to write directly to C:. Have > > you tried to save the file to your Documents folder? > > > > Regards, > > Alba > > no, it's the ssh-server denying a log on from 'root' I'm going to go out on a limb and say that's pretty clearly not the issue. The exception states that the problem is one of permissions on the C: PermissionError: [Errno 13] Permission denied: 'c:' which ishish clearly identified as a "Windows doesn't let you do that any more" issue. Additionally, I don't know off the top of my if the Paramiko libraries expect a file-name, or if they expect a directory into which the file gets put based on the server-side name. The best solution is to do as ishish proposed: write the file to some other appropriate (i.e., writable) location. A simple fix might be import os # ... localpath = os.path.expanduser('~') or localpath = os.path.join( os.path.expanduser('~'), 'passwd.txt', ) A stop-gap solution might be to just run the program in a writable directory: c:\> cd %TEMP% c:\...\TEMP> python myprog.py A far worse solution would be to run the script as Administrator on the Win32 box, which will grant permission to write in the root of C: -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:?
Am 08.12.2014 19:11 schrieb Luuk: no, it's the ssh-server denying a log on from 'root' You are repating yourself. How could possibly with open(localpath, 'wb') as fl: PermissionError: [Errno 13] Permission denied: 'c:' be a problem with the SSH server? -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:?
Am 09.12.2014 09:14 schrieb pengsir: My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server into my local window disk c: . localpath = 'c:' [...] with open(localpath, 'wb') as fl: PermissionError: [Errno 13] Permission denied: 'c:' That's completely clear: you are not allowed to create a file named 'c:'. You should replace it with a full path name, such as localpath = 'c:\\passwd' or such. Thomas -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:?
On Mon, 08 Dec 2014 19:11:40 +0100, Luuk wrote: > On 8-12-2014 18:37, ishish wrote: >>> with open(localpath, 'wb') as fl: >>> PermissionError: [Errno 13] Permission denied: 'c:' >> >> I remember gloomily (haven't used windows since ages) that newer >> Windows versions don't like users to write directly to C:. Have you >> tried to save the file to your Documents folder? >> >> Regards, >> Alba > > no, it's the ssh-server denying a log on from 'root' windows systems dont usualy have an SSH server & root is not a normal windows user name on most systems that DO have a ssh server root logins are usually prohibited, either enable root logins (dangerous) or log in with a user that has permissions to do what you require. if you don't have access to the server then you need assistance from someone who is authorised. -- Do you know Montana? -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:?
On 2014-12-09 08:14, pengsir wrote: My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server into my local window disk c: . import paramiko host = "x.y.z.w" port = 22 transport = paramiko.Transport((host, port)) password = "mykey" username = "root" transport.connect(username = username, password = password) sftp = paramiko.SFTPClient.from_transport(transport) filepath = '/etc/passwd' localpath = 'c:' sftp.get(filepath, localpath) Traceback (most recent call last): File "", line 1, in File "D:\Python34\lib\site-packages\paramiko\sftp_client.py", line 719, in get with open(localpath, 'wb') as fl: PermissionError: [Errno 13] Permission denied: 'c:' It's trying to open the file 'c:', but that's not a file, it's a folder. Try, say, 'c:/passwd' instead. -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:?
On Tue, Dec 9, 2014 at 5:11 AM, Luuk wrote: > On 8-12-2014 18:37, ishish wrote: >>> >>> with open(localpath, 'wb') as fl: >>> PermissionError: [Errno 13] Permission denied: 'c:' >> >> >> I remember gloomily (haven't used windows since ages) that newer Windows >> versions don't like users to write directly to C:. Have you tried to >> save the file to your Documents folder? >> >> Regards, >> Alba > > > no, it's the ssh-server denying a log on from 'root' It looks to me more like an issue with path naming. Try 'c:/' instead of 'c:', or use '/' to mean the root directory of the current drive. Alternatively, do a web search for the problem and the symptoms, as you're unlikely to be the first person to have run into this. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:?
On 8-12-2014 18:37, ishish wrote: with open(localpath, 'wb') as fl: PermissionError: [Errno 13] Permission denied: 'c:' I remember gloomily (haven't used windows since ages) that newer Windows versions don't like users to write directly to C:. Have you tried to save the file to your Documents folder? Regards, Alba no, it's the ssh-server denying a log on from 'root' -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:?
with open(localpath, 'wb') as fl: PermissionError: [Errno 13] Permission denied: 'c:' I remember gloomily (haven't used windows since ages) that newer Windows versions don't like users to write directly to C:. Have you tried to save the file to your Documents folder? Regards, Alba -- https://mail.python.org/mailman/listinfo/python-list
Re: why can't download file from linux server into local window disk c:?
On 9-12-2014 09:14, pengsir wrote: My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server into my local window disk c: . import paramiko host = "x.y.z.w" port = 22 transport = paramiko.Transport((host, port)) password = "mykey" username = "root" transport.connect(username = username, password = password) sftp = paramiko.SFTPClient.from_transport(transport) filepath = '/etc/passwd' localpath = 'c:' sftp.get(filepath, localpath) Traceback (most recent call last): File "", line 1, in File "D:\Python34\lib\site-packages\paramiko\sftp_client.py", line 719, in get with open(localpath, 'wb') as fl: PermissionError: [Errno 13] Permission denied: 'c:' You, 'root', does not have enoug permission to do it C:\temp>\util\Putty\pscp root@opensuse:/etc/passwd . Using keyboard-interactive authentication. Password: Access denied -- https://mail.python.org/mailman/listinfo/python-list
why can't download file from linux server into local window disk c:?
My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server into my local window disk c: . import paramiko host = "x.y.z.w" port = 22 transport = paramiko.Transport((host, port)) password = "mykey" username = "root" transport.connect(username = username, password = password) sftp = paramiko.SFTPClient.from_transport(transport) filepath = '/etc/passwd' localpath = 'c:' sftp.get(filepath, localpath) Traceback (most recent call last): File "", line 1, in File "D:\Python34\lib\site-packages\paramiko\sftp_client.py", line 719, in get with open(localpath, 'wb') as fl: PermissionError: [Errno 13] Permission denied: 'c:' -- https://mail.python.org/mailman/listinfo/python-list