User login

Getting out of the local permissions / server login catch 22

The first step to getting out of the local permissions / server login catch-22 is to know you're in it.

Perhaps you found this page searching for "Permission denied on publickey even though I can log into the server with a public key it doesn't make any sense grrr argh how dare it deny me i created it why won't it work permissions are correct this isn't right" or something like that.

Your problem is that when you run the command without sudo, you don't have the proper permissions locally, and your computer doesn't even try to connect to the server:

Ebony-II:default ben$ scp -r ben@agaricdesign.com:/var/www/drupal-5_2-live/sites/anjaliforberpratt.com/files files
files: Permission denied

But when you add sudo in front, you are actually trying to log into the server from your local computer's root user account, which does not (in this case) have its public key (id_dsa.pub or id_rsa.pub cat'ed to authorized_keys on the server's root account).

Ebony-II:default ben$ sudo scp -r ben@agaricdesign.com:/var/www/drupal-5_2-live/sites/anjaliforberpratt.com/files files
Permission denied (publickey).

What to do? You could download the files you want into your home directory or somewhere else you have permission... or use your sudo powers to make sure you will never get permission denied locally!

Ebony-II:default ben$ sudo chmod 777 .

Now, the non-sudo version of the command works:

Ebony-II:default ben$ scp -r ben@agaricdesign.com:/var/www/drupal-5_2-live/sites/anjaliforberpratt.com/files files

Thank you, and this solution has been brought to you by the How-did-it-take-so-long-to-figure-that-out Foundation.

Resolution

Searched words: 
authorized keys

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.