0

What I would like to do:

I would like to start my wireless network after login (As apposed to starting at boot). Using my login credentials to run the command: sudo netctl start network. Instead of needing to Login once, then login my credentials a second time to start networking, at the same time I would prefer not having my system bootup with networking enabled.

The crux:

I thought I could just add it to .xinit but startx doesn't require sudo, however netctl does and therefore will not run.

I then thought about running it in my .bash_profile but that doesn't seem to work, for the same reason.

Is there a way to run networking at login, while just supplying login credentials once?

OS: Arch Linux

2
  • What distribution are you running, because I remember I had to do the exact opposite on my laptop (but I'm not sure if that was for Ubuntu 12.04 or Linux Mint 17) – Anthon Nov 7 '14 at 12:30
  • I am using Arch Linux – P0LYmath Nov 7 '14 at 12:35
1

Configure sudo to allow you to run the command without a password:

As root:

# visudo

append the following:

<username> ALL = NOPASSWD: netctl start network, netctl stop network

where <username> is your username (without < and >) or ALL to allow everyone to do this. You can also stipulate a group by preceding it with a % (eg %admin).

0

You can use the methods you tried but allow the user to run the command without asking for a password.

You would need to edit the visudo file to allow one user to run this command without asking for a password.

Run sudo EDITOR=nano visudo add a line at the end as follows:

username ALL = NOPASSWD: /usr/bin/netctl

After logging out and in again you can try using your .bash_profile to start the command. Include sudo before the command.

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.