Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 09-07-2009, 07:34 PM   #1
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Lightbulb Script using cnetworkmanager to start a NetworkManager connection from a terminal.

I had (and still have, but that a different issue) a problem with a video driver (nouveau) crashing the x-server on the Fedora 12 alpha release, so I needed to connect my laptop to the Internet via my wireless connection without using a window manager.

Fedora 12 includes the cnetworkmanager package for access the NetworkManager functionality from the command line, but that package does not exit after the connection is made. Of course, you can do a Ctrl-Alt-F3 to open a new terminal window, but that seemed to me to be somewhat inelegant. So I wrote a simple script to which I could pass an access point name and a WPA2 pass-phrase that would do the job for me. Since it worked well, I thought others might find it useful. So, here it is:
[ $# -eq 0 ] && echo Usage $0 AP [pass_phrase] && exit 1
[ -z "$pass" ] && pass=.....
cnetworkmanager -C $1 --wpa-pass $pass &
Note 1: Tthe default pass-phrase is redacted, and the script is in /root so it's somewhat protected.

Note 2: cnetworkmanager --help describes alternatives to WPA encryption. The script is, obviously, specific to my needs.

Note 3: I don't know if the cnetworkmanager package is generally available, but, if it is, it's a nice tool to have available. (Although the curses interface to wicd is, actually, much easier to use. Unfortunately, wicd isn't in the Fedora rawhide repository, so NetworkManager is the only way to go unless you're a masochist who like to manage your connections by hand.)


network manager

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
vpnc and NetworkManager: no connection Philip87 Linux - Networking 1 06-24-2009 07:12 AM
running a program start script in terminal fenriswoolf Linux - Software 1 04-01-2008 09:25 AM
Script to start network connection? {e} Linux - General 7 08-05-2007 06:00 AM
How Do I start NetworkManager? lonecrow Linux - Software 12 09-28-2006 05:53 AM
I can't start NetworkManager ? naihe2010 Linux - Software 0 11-13-2005 05:51 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:47 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration