Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
gpg: cannot open `/dev/tty': No such device or address
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2583

PostPosted: Mon Jan 18, 2016 4:51 pm    Post subject: gpg: cannot open `/dev/tty': No such device or address Reply with quote

Could someone help with this? I came across from the Pulling validated Gentoo ebuild tree snapshots of the handbook.

When I do
Quote:
$ su -c "gpg --homedir /var/lib/gentoo/gkeys/keyrings/gentoo/release --edit-key 0xF6CD6C97 check"

it tells me
Quote:
Password:
gpg: WARNING: unsafe permissions on homedir `/var/lib/gentoo/gkeys/keyrings/gentoo/release'
gpg (GnuPG) 2.0.28; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gpg: cannot open `/dev/tty': No such device or address

Searching the internet for this message I could not find a solution.
Any idea? What's the problem with gnupg and /dev/tty?
Back to top
View user's profile Send private message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 738

PostPosted: Mon Jan 18, 2016 10:18 pm    Post subject: Reply with quote

The warning indicates the permissions of the "homedir" are wrong - they probably need to be 0700.

edit-key is by nature an interactive command, but you're not running interactively. Try --no-tty.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2583

PostPosted: Tue Jan 19, 2016 11:59 am    Post subject: Reply with quote

Thanks Princess Nell for your answer.
Changed the permission to 700. But when I try with --no-tty
Quote:
su -c "gpg --no-tty --homedir /var/lib/gentoo/gkeys/keyrings/gentoo/release --edit-key 0xF6CD6C97 check"

It would end up with
Quote:
Password:
gpg (GnuPG) 2.0.28; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gpg: Sorry, no terminal at all requested - can't get input

That also doesn't look very promising.

But when I try it as root it works
Quote:
root # gpg --homedir /var/lib/gentoo/gkeys/keyrings/gentoo/release/ --edit-key F6CD6C97 trust
gpg: WARNING: unsafe ownership on homedir `/var/lib/gentoo/gkeys/keyrings/gentoo/release/'
gpg (GnuPG) 2.0.28; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


pub 4096R/F6CD6C97 created: 2014-10-03 expires: 2017-09-17 usage: C
trust: full validity: unknown
sub 4096R/151C3FC7 created: 2014-10-03 expires: 2017-09-17 usage: S
[ unknown] (1). Gentoo-keys Team <gkeys@gentoo.org>

pub 4096R/F6CD6C97 created: 2014-10-03 expires: 2017-09-17 usage: C
trust: full validity: unknown
sub 4096R/151C3FC7 created: 2014-10-03 expires: 2017-09-17 usage: S
[ unknown] (1). Gentoo-keys Team <gkeys@gentoo.org>

Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)

1 = I don't know or won't say
2 = I do NOT trust
3 = I trust marginally
4 = I trust fully
5 = I trust ultimately
m = back to the main menu

Your decision?


Why can't I do that from normal user with su -c?
Back to top
View user's profile Send private message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 738

PostPosted: Tue Jan 19, 2016 10:16 pm    Post subject: Reply with quote

Use --batch, not --no-tty. And update those permissions :)
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2583

PostPosted: Wed Jan 20, 2016 8:25 am    Post subject: Reply with quote

Princess Nell wrote:
Use --batch, not --no-tty. And update those permissions :)

Works for
Quote:
$ su -c "gpg --batch --homedir /var/lib/gentoo/gkeys/keyrings/gentoo/release --edit-key 0xF6CD6C97 check"

But not for
Quote:
$ su -c "gpg --batch --homedir /var/lib/gentoo/gkeys/keyrings/gentoo/release --edit-key 0xF6CD6C97 trust"
...
...
gpg: Sorry, we are in batchmode - can't get input

Seems that su -c "gpg ......." is not so recommended
Back to top
View user's profile Send private message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 738

PostPosted: Wed Jan 20, 2016 9:39 pm    Post subject: Reply with quote

The second command is incomplete and waiting for input, so not a candidate for --batch in this form.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum