You are not logged in.

#1 2016-06-30 20:34:40

chuckd833
Member
Registered: 2016-06-17
Posts: 8

[SOLVED] Auto connect to wifi after TTY login using script

I login in to TTY after boot then use startx to run a DE.

To automatically connect to home wifi, instead of using NetworkManager, for example, I was just wondering if it is possible to add this:

# ip link set dev wlp13s1 up
# wpa_supplicant -B -i wlp13s1 -c /etc/wpa_supplicant/wpa_supplicant.conf
# dhcpcd wlp13s1

to a script and then execute that script only once after I login by adding something to:

/etc/pam.d/login

OR

/etc/profile.d

If so which should I use?

Thanks in advance.

Last edited by chuckd833 (2016-07-01 01:40:48)

Offline

#2 2016-06-30 20:36:28

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Auto connect to wifi after TTY login using script

Is there any reason you don't use something like systemd-networkd, which would do that same thing, only a lot more robustly?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2016-06-30 21:04:45

chuckd833
Member
Registered: 2016-06-17
Posts: 8

Re: [SOLVED] Auto connect to wifi after TTY login using script

No. No Reason. I was just trying to do as much as I could using linux command line as opposed to using connman or wicd etc.

So I thought I would connect to my wifi using

wpa_supplicant

like the OP all the time and then thought I'd try to simplify that process without using connman, wicd etc.

I was aware of

systemctl enable wpa_supplicant@wireless-interface.service

but hadn't looked at systemd-networkd.

If that is a preferred method, I'm happy to go with that. I'd just prefer to use the cli to manage the networks manually as far as I could.

Offline

#4 2016-06-30 21:18:29

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Auto connect to wifi after TTY login using script

It is entirely up to you. Understanding how to connect manually is an important skill, but if you wish to automate it, I would use a service as that will accomplish the same thing, but will be much more resilient and will provide logging should something go wrong.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2016-07-01 01:39:32

chuckd833
Member
Registered: 2016-06-17
Posts: 8

Re: [SOLVED] Auto connect to wifi after TTY login using script

Point taken. There will be certain circumstances like if the connection drops where I'd have to reconnect. And waking up from a suspend state will probably be an issue too.

Thanks for the pointer. I'll use systemd.

Offline

Board footer

Powered by FluxBB