5

I'd like to create a Debian VM with a guest login. The guest would be allowed to work with /etc/network/interfaces in order to configure the VM's IP, name, and so on. Is this possible to do? How?

From other posts and articles online, I get an impression that the user must be root in order to change the interfaces. Is there a workaround?

2 Answers 2

6

Add the user to netdev group : The members of this group can manage network interfaces through the network-manager and wicd:

Add user:

adduser user_name_here netdev

Reload dbus:

/etc/init.d/dbus reload

Edit

This right is gained by adding the user to the netdev group:

On Debian, the "netdev" group gains access to using Network Manager. On Ubuntu, Network Manager access rights are gained by being at the system console, so the name of this entry in gnome-system-tools is misleading.

The "netdev" group can administer wicd and wpasupplicant.

The "netdev" group can set the avahi host name using DBus.

The "netdev" group can administer Bluetooth devices.

1
  • 2
    Thank you, from a quick test, this seems to be exactly what I need. Are there any "gotcha" do I need to know about network-manager? Anyway for the user to use it and gain more rights/privileges on the system?
    – Roman Mik
    Commented Nov 23, 2016 at 19:44
0

Utilize sudo for this. Edit the sudoers file using the command 'visudo'. You can use something like the following:

User_Alias NETWORKING_USERS = guest1, guest2, ...

Cmnd_Alias NETWORKING_COMMANDS = /usr/bin/vim /etc/network/interfaces, /path/to/other/command args, ...

NETWORKING_USERS ALL= NOPASSWD: NETWORKING_COMMANDS

Then guest users can do:

sudo vim /etc/network/interfaces

or any other command you included using visudo. The NOPASSWD keyword is optional. If you prefer to have users enter their password, just remove it.

5
  • Thank you for your answer. Unfortunately, the commands executed by this user will not persist after the reboot. How could I could accomplish it?
    – Roman Mik
    Commented Nov 22, 2016 at 14:13
  • So you're saying you successfully allowed a guest user to use sudo to edit and save /etc/network/interfaces but after reboot, the file was reverted to its previous state? Commented Nov 22, 2016 at 20:17
  • Thanks for the edit. However, I get sorry, user guest is not allowed to execute '/usr/bin/vim /etc/network/interfaces' as root on debian. Also, I noticed that visudo starts to complain about the Alias . I get "Warning: Host_Alias 'NETWORKING_COMMANDS' referenced but not defined. However, I did not reference that alias.
    – Roman Mik
    Commented Nov 22, 2016 at 22:06
  • Maybe I'm missing something that is obvious to linux users? I have very little experience with Linux and almost none in administration
    – Roman Mik
    Commented Nov 22, 2016 at 22:07
  • It's possible the /etc/sudoers file is dynamically generated or overwritten upon reboot. For additions to your list of sudoers, you should use a file like /etc/sudoers.d/10_netdev and put all the config lines in this answer in that file.
    – bgStack15
    Commented Nov 23, 2016 at 20:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .