LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-20-2012, 04:06 AM   #1
guardian1
LQ Newbie
 
Registered: May 2012
Posts: 19

Rep: Reputation: Disabled
Using python GNUPG module over SSH


Hello all,

I have recently started using Python GNUPG for signing and verification, and it has been working well. My current intention is to be able to do this using similar scripts over SSH.

Logging into my SSH server with the script is no problem. However when running the line which is usually able to load the Python GNUPG details on a local machine, a problem occurs. The line, with the accompanying traceback is:

gpg = gnupg.GPG(gnupghome="/home/toolserv/.gnupg")

Traceback (most recent call last):
File "sshx.py", line 10, in <module>
gpg = gnupg.GPG(gnupghome="/home/toolserv/.gnupg")
File "/usr/local/lib/python2.7/dist-packages/gnupg.py", line 495, in __init__
os.makedirs(self.gnupghome,0x1C0)
File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/toolserv'

Manually logging in via SSH I get the following for user permissions:

toolserv@toolserv:~$ ls -ld /home/toolserv/
drwxr-xr-x 29 toolserv toolserv 4096 2012-08-19 22:38 /home/toolserv/

I'm new to SSH and can't figure out what the problem is here. Any help please?
 
Old 08-20-2012, 07:00 AM   #2
guardian1
LQ Newbie
 
Registered: May 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Confusingly, if I launch the script as sudo on the local side, it gets past the error mentioned. However, it gives another one, for a file I am trying to load in it says that it is not there:

Python code:

gpg = gnupg.GPG(gnupghome="/home/toolserv/.gnupg")

with open("result1.txt", "r") as my_file:
signed_data1 = pickle.load(my_file)
my_file.close()

New error message:

Traceback (most recent call last):
File "sshx.py", line 11, in <module>
with open("result1.txt", "r") as my_file:
IOError: [Errno 2] No such file or directory: 'result1.txt'
 
Old 08-20-2012, 08:53 AM   #3
guardian1
LQ Newbie
 
Registered: May 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
I think the answer to this problem is that through python's paramiko, to read in files, one has to use the paramiko defined read in modules, which I hadn't noticed beforehand.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
configure: error: The xdg python module is required (pyxdg or python-xdg) Sargalus Linux - Software 7 03-24-2010 07:34 AM
[SOLVED] Python 3.1.1 and module Pycrypto 2.1.0 grail Linux - Software 1 01-14-2010 09:09 PM
Python: How to use the re module? donnied Programming 2 01-19-2009 12:26 PM
python update - Unable to load GTK2 Python bindings: No module named gtk itpedersen Linux - Software 2 10-03-2008 03:44 AM
SSH public/private key authentication with GnuPG keys? thinksincode Linux - Security 1 02-25-2005 02:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration