1

This question arises on a Pi running RasPBX, which is Rasbian + Asterisk, but I think it will be the same under straight Raspbian. I run certain admin functions remotely against the PI from a Windows machine elsewhere on the network, by launching a putty window that executes a Linux command on connecting. I use putty's inbuilt feature for this, located in the connection settings at the root level of the SSH folder:

enter image description here

I didn't initially have a way to run these admin functions as a user with limited permissions, which it would make sense to do. After reading this useful info on *nx SE, it struck me the sudoers mechanism was the obvious way. But when I try to apply the linked guidance, starting with

edit the sudoers file with an existing sudo user, with the command sudo visudo

I am immediately advised, by a comment in the sudoers file being opened,

# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.

Fair enough, but when I go to directory /etc/sudoers.d/, the one file there (README) passes the buck right back again:

# Finally, please note that using the visudo command is the recommended way
# to update sudoers content, since it protects against many failure modes.

I want to do it right, but doing it right would appear not to be an option. I guess I'll have to toss a coin. Unless the community has any more wisdom on this?

5
  • 1
    Your question is lacking in real information. What user, what command are you trying to do? What does "passes the buck right back again" mean in English? NOTE in Raspbian you should NOT fiddle with /etc/sudoers – Milliways Jan 29 '17 at 22:31
  • 1
    @Milliways "passes the buck" == circular advice -- OP believes the default file says "use the directory," but the README in the directory says "use the default file." I suspect that isn't the intended meaning although it's also possible that one message came from further upstream than the other. – Michael - sqlbot Jan 30 '17 at 4:09
  • 2
    @Milliways your attempt at sarcasm comes across as a lack of understanding of the question... a question that seems perfectly clear to me. I see nothing unclear about it, and I believe I can recognize a question needing closure. You continue to complain that everybody's doin' it wrong, without offering any genuine help in the right direction. – Michael - sqlbot Jan 30 '17 at 11:22
  • @Milliways, I can't help noticing that your emphatic advice, "NOTE in Raspbian you should NOT fiddle with /etc/sudoers", flatly contradicts both pieces of advice I'm citing in my question (which are themselves mutually contradictory). This development adds a further complexity. Please can you provide a reference? Thx – Reg Edit Jan 30 '17 at 13:19
  • This appears to be an XY problem. You are asking about your assumed solution (in which case it belongs on unix.stackexchange.com ). If you asked about your actual problem you may get some help. My comment is admittedly an opinion, widely shared. There are a few cases where it appropriate, but your problem is misinterpreting the comment intended for Administrators of shared systems. – Milliways Jan 30 '17 at 22:56
1

I suspect the message doesn't mean what it appears to say.

# Finally, please note that using the visudo command is the recommended way
# to update sudoers content, since it protects against many failure modes.

If my interpretation is correct, this doesn't mean "put all your configuration in /etc/sudoers."

It means "use the visudo utility -- not anything else -- to edit all configuration files."

The visudo utility can edit a specific file: visudo -f /path/to/filename.

Using visudo checks for errors before saving changes, and tries to prevent you from shooting yourself in the foot. Mistakes in any sudo configuration can make sudo unusable, and without sudo, you can't give yourself permission to fix what you broke... vicious circle.

3
  • Great, so kindly enlighten us. As an experienced user on Stack Overflow, Server Fault, dba.SE, and others, the apparent hypercriticality in evidence here has caught me entirely off guard. "Merely repeating the contents of the file" ... two lines. I copied two lines, and that was not repetition for its own sake... it was for context. – Michael - sqlbot Jan 30 '17 at 11:30
  • Michael, thank you, that's exactly what I needed--didn't realize visudo could edit a specific file. It all makes sense now. In that case, it seems to me both the comments I encountered could be improved to make that very point clear! On another note... I'm not entirely sure what else is going on here, as I'm seeing deleted comments and deleted material at a link you provided, but fwiw you have presented everything very helpfully for me. Hope you have a plentiful supply of patience... keep doing what you do. – Reg Edit Jan 30 '17 at 13:11
  • @RegEdit thanks. I'm not quite sure, either. The link in my other comment was just a link to the 900+ questions I have personally voted to close on Stack Overflow, in an attempt to suggest that I am in some sense able to recognize a question that is a candidate for closure, and that yours didn't seem like one of them to me. It was probably not a productive comment on my part but I was confused and dismayed by the seemingly icy welcome we both received. – Michael - sqlbot Jan 30 '17 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.