# [SOLVED] Getting internet right after login

## GivePeaceAChance

Hi,

Currently, no matter what I do with trying to get internet to be ON when I log in, playing with my "wireless" file, or playing with my "net" file, I just can't seem to get my internet to be working the second I log into my machine as user.  To get (wireless) internet, I have to go into the shell, and use:

[code]

$ sudo iwconfig eth1 essid "Home" nickname "Gentoo Node" key [1] 1234567890 open

[/code]

and THEN I can surf the net.

How can I get this command to run at startup without me typing it in every time? (This is what I'm going to consider my quick-fix solution to my internet woest atm. If it works right now, out of the box, then I'm happy. What (mis-configurating) I can't see can't hurt me.Last edited by GivePeaceAChance on Tue Dec 18, 2007 8:48 am; edited 1 time in total

----------

## baeksu

If you use KDE, Gnome or XFCE, you can add the command to the autostart. Otherwise you can use it in your .xinitrc or .xsession file, depending on whether you do 'startx' or use KDM/GDM.

If you only use the terminal, however, the only thing I can think of is to make an alias for it in your .bashrc. At least then you won't have to type such a long command every time.

If you don't care about logging in, you could also always add it to your /etc/conf.d/local.start

----------

## GivePeaceAChance

I'm drawing a blank.... where is the .xinitrc file?  :Razz:  I use fluxbox, btw.

----------

## dnial

/etc/xinit/xinitrc

----------

## JC99

You can add any command to be run at boot in this file...

/etc/conf.d/local.start

----------

## GivePeaceAChance

Good to know!  :Razz:  Now about this command: in order to use it, I either have to su into root, or use sudo, which I set up for my user.  As such, I can't see how it can be run at boot, since it requires a password input. Is there a way to give it that too, or should I go about this a different way altogether?

----------

## Inodoro_Pereyra

sudo will not require any password to run if you put in your /etc/sudoers:

```

here_your_username   ALL=(ALL) NOPASSWD: ALL
```

Salud!

----------

## GivePeaceAChance

OK, but what if I want the user to input the password each time they sudo, except for this one instance, is that possible? (if not, I'll just go ahead and put that line in sudoers)

----------

## JC99

Why not create a new user with the right permissions and only use that user for this. That way your account isn't affected.

----------

## GivePeaceAChance

Not a bad idea. I'll give it a try.  :Smile: 

----------

## GivePeaceAChance

OK, I created a new user called networking like this:

```
useradd -G users -p tehinterweb networking
```

I'm hoping that's right, because when I typed "groups networking" it spit out "users networking"

Anyway, that said, the only reason I want this user is to run the following command when my computer turns on (i.e. a background process that only I actually know about since I made it) so I don't care to have anything else going on with this user.

Now I want the command to run. So in /etc/local.start, I want to make this user run the following command:

```

sudo iwconfig eth1 essid "Home" nickname "Gentoo Node" key [1] 1234567890 open

```

How do I do that and make the user 'networking' execute that command? And does /etc/local.start run the commands when the computer turns on, or when a user, say 'Me' logs in?

----------

## JC99

Yeah, that looks right

P.S. Its /etc/conf.d/local.start not /etc/local.start

----------

## GivePeaceAChance

Right. D'oh. so how do I make "networking" execute the command though? I'm assuming just putting this line in that file won't work:

```

sudo iwconfig eth1 essid "Home" nickname "Gentoo Node" key [1] 1234567890 open

```

Something has to tell the computer that I want "networking" to execute that command, right?

----------

## JC99

Try that line and see if it works then let us know.

----------

## GivePeaceAChance

Here's my file. Gonna reboot and see what happens.

```

# /etc/conf.d/local.start

# This is a good place to load any misc programs

# on startup (use &>/dev/null to hide output)

sudo iwconfig eth1 essid "Home" nickname "Gentoo Node" key [1] 1234567890 open

```

----------

## GivePeaceAChance

Jesus..... talk about a weird way to go about doing what I wanted in my initial post.  :Razz:  Well it works, so no worries I guess. Mind you, this is still just a quickfix while I'm at home with a known wireless connection that I know I won't be deviating from.  We'll see what happens when I get back to university.

Thanks for helping me out. That's one thing off my long Gentoo todo list, no matter how "quick-fix/temporary" this may be.

----------

