Showing posts with label configuration. Show all posts
Showing posts with label configuration. Show all posts

Saturday, May 05, 2018

Setup WiFi to auto-connect regardless of logged in state (UPDATED)

There are plenty of times where I would like to start up my desktop machine (running Ubuntu 16.04 LTS) and just have it boot and me log into it via SSH so that I can get some work done.  Well, in order to achieve that wish, you need to have your wifi connection auto-connnect at boot time.

To do this, there are some things you need to do:

1.  Go to your wifi connection in the upper right of your screen and click on "Edit Connections".
2.  Once in there, you need to click on your connected wifi ssid and select "Edit".
3.  Go to the "General" tab and select "All users may connect to this network".  (without this, the rest of this is moot and it will not work)

Ok, that is the only gui portion of this setup.  Next:

4.  Create the file /etc/wpa_supplicant.conf and add the content that follows:

ctrl_interface=DIR=/var/run/wpa_supplicant group=wheel
network={
  ssid="your_connection_ssid"
  scan_ssid=1
  key_mgmt=WPA-PSK
  psk="password"
}
In the above code, you will input your ssid that you would like to connect to and also enter your password for the connection.  If you are using an encryption method other than WPA/WPA2, then you will need to reference the man page for wpa_supplicant.conf.  There are plenty of examples to help you out. 

After you have that file all setup, save it.

5.  Issue the following command on the command line, as root or with sudo:

wpa_supplicant -B -i wlp4s0 -c /etc/wpa_supplicant.conf

You should see a message that says something to the effect that wpa_supplicant initialization was successful.

After you have completed those steps, go ahead and reboot the machine and watch the login screen.  If all is correct and right with the configuration, you should see the wifi connection show as connected.  You can test this by ssh'ing to the machine.  Enjoy!


UPDATE:  I took the opportunity to reinstall my Linux system to go from Ubuntu 16.04 LTS to Ubuntu 18.04.  I know its a bit extreme to do a full re-install, but:

1.  An distribution upgrade wasn't yet available
2.  There wasn't anything I couldn't re-setup on the machine
3.  Ubuntu moved away from Unity to the Gnome desktop, so I wanted everything clean and fresh.

I will say this though, auto-connection of the wifi (seeing as how you tell it how to connect during installation) just WORKS with Ubuntu 18.04.  You just have to make sure to install the openssh-server package.

Thursday, September 03, 2015

raspi-config Missing On Kali Linux 2.0

A couple of months ago I purchased one of the shiny new RaspberryPi2's (you know, the one with the 900 Mhz quad core chip and the 1Gb of on-board ram) and have been playing with it.   Within the last couple of weeks, Kali Linux 2.0 was released.  Seeing as how I have this sweet RaspberryPi laying around, I figured, why not get Kali 2.0 running on it. 

So, for my birthday, my awesome wife got me a Class 10, 32Gb MicroSD card.  So I promptly loaded it with the freshly downloaded Kali Linux 2.0 image and booted it.  After logging in to the machine I did a 'df -h' and discovered that instead of the 32 Gb I expected to see (ok, so it would be 30Gb after reserve), I was only seeing around 7Gb of space.   I hadn't run into this quandry before as I had only had an 8gb card before. 

So, I did some googling and found that you can finagle the partition table with fdisk (which isn't installed by default, btw.  You will need to install the 'afflib-tools' package in order to get fdisk installed) and then reboot and resize the root partition.  Or, as a friend pointed out, you can simply run raspi-config and it will quickly (and quietly) do it for you. 

So I searched around and what do you know..... no raspi-config.  Apparently they don't see a need for this extremely useful utility on Kali, so you will need to install it yourself, which, after doing it, wasn't that awful.

First, download the latest version of raspi-config from  'http://archive.raspberrypi.org/debian/pool/main/r/raspi-config'.  Just search in there and either click to download it, or, if you are like me, copy the link and wget it. Note: Remember to download the .deb file as this is a debian distribution.

Next, you need to install the two prerequisites for raspi-config:

  # apt-get install triggerhappy lua5.1

After you have installed those two, you can simply change directories to wherever you downloaded raspi-config and issue the following command:

  # dpkg -i .deb

After that, you should be able to run raspi-config.  The first option is to resize the partition to reclaim space on the card.  That is what you want.  It will tell you to reboot.  Once you do, voila!, space reclaimed and your 'df -h' should show a ton more space (relatively that is).

Thursday, October 02, 2014

Passwords In Your Bash History

This is one of those things that is utterly annoying because you can only get mad at yourself.  At work, I have my ssh key populated on a lot of our systems, but there are also plenty of systems where it is not residing as of yet.  When I really get working on something, and working in a quicker than usual manner, there will be times I ssh to a system and don't realize that it "just connected".  The problem is that my fingers are acting way ahead of what I am seeing and have already typed my password and hit enter. 

Well, the problem is that your going to get an error because you password is not typically a command.  Its at that point that you will realize that you messed up and that password is now residing in your bash history. 

Initial searches will show that you can simply edit your history file and remove the offending line(s).  Sure, but I don't want to have to go through all that if I don't have to.  So, digging further you will find that you can simply do this (assuming that you did not type anything else after typing your password and hitting enter):

    history -d $((HISTCMD-1))

This works because the above command adds a line to the history file and you want the previous entry, which is your beloved password.  It will promptly remove it from the history, saving you the worry of having it in there.  The HISTCMD returns the latest command number in the history (reflecting the command you are entering currently to display it).

Now, if you continued typing in commands and figured you would get back to removing it, there is another way you can do this.  First, type 'history' and hit enter.   If your like me, you have your history sett to be thousands of lines, so you may want to pipe it through less or more to halt the scrolling off of your screen, like so:

    history | less

The output will look similar to the following (just more lines):

    757  ls
    758  ls -lart
    759  cat .bashrc
    760  exit
    761  clear

The line number is to the left and the command that was entered is on the right.

Find the line number with your password and issue the following:

    history -d

replacing with the offending number from the history output.

Another example is, say you want to remove all occurrences of a command from your history (and this could work for your password as well).  Simply run the following:

    history | grep "clear" | awk '{print $1}'

That will output the line numbers in your history.  You then just type them each into a 'history -d' to remove them.  Yes, that's tedious, but that is where shell scripting comes in really handy.  Write a script to do it for you.  For instance the shell script could:

- take a single word command as input (to search for)
- find all occurrences of that command in the history and save the line numbers (to an array)
- cycle over the array and run each number through a 'history -d', removing it.

There are a bunch of possibilities.  Of course, you can also add a bit of configuration to your history, reducing occurrences.  In your .bashrc, you can set the HISTCONTROL variable with options that tell the history how to act. 

In my .bashrc you will find the line:

    export HISTCONTROL=ignoredups:ignorespace

What that does is tell history to not record a command that is already in the history, and to ignore a leading space.  That last one is VERY useful when you want to do something but not have any record of it in your history.  You simply hit a space before typing your command and that command will not end up in your history.

Hopefully this helps someone out there keep their passwords secret and not in their history file. 






Tuesday, May 03, 2011

To Setup Or Not To Setup?

I know, that is a pretty vague question I pose as the subject of this post. To clarify, I am talking about a mail server. On my new server, I have been setting up a lot of things, but one thing I have yet to setup was a mail server.

I was torn because I really wanted to have mail from my new domain and without a mail server, that just isn't possible. First and foremost is that I have absolutely no experience setting up a mail server. You have to think about things like:

- the installation of the software for mail delivery (ie: Postfix, Sendmail),
- the managing of spam with software like SpamAssassin.
- the increase in traffic on your site due to email

As you can see, there are a lot of things to think about, and this short list is just that, short. So, in speaking with a friend today led to a suggestion which, in a matter of only a couple of hours work, I have implemented.

I have Ben Howarth of CodeGecko to thank, not only for the suggestion that follows, but also for his guidance in setting it up. I also want to thank him for being so infinitely patient with me as I can ask a lot of questions when I am learning something new. You rock, Ben!!!

The suggestion that Ben made was to use Google Apps Standard (Free) Edition. He quickly enlightened me as to the fact that it would use my domain and that all the emails would be for my domain. The sweet part is that Google handled all the email server end of it, which means you get Google's absolutely incredible spam filtering capabilities and scanning for attachments. It also comes with a bunch of free apps such as Google Docs, Google Chat and much more.

A quick search of the internet on setup guides for Google Apps landed me here, which proved to be a good "get you going in the right direction" guide. It at least got me to the sign up site, which it what I needed.

The sign up process was pretty painless and even the verification was cake (upload an html file to your site, visit it and then tell the setup you did it). When it came to the DNS setup on GoDaddy (where I bought my domain), that is where Ben really shined. He gave me a really good set of explanations into the inner workings of CNAME's, MX records and DNS as a whole, helping me to get a better grasp on it than I previously had.

Its hard when you are a geek and all of a sudden have to work with technologies that you have never messed with before, but its wonderful when there are friends who are willing to help.

After all was setup, Ben dropped another Easter Egg in my lap, telling me that instead of the nice long URL that Google gives you to access your email accounts, you can set it up for your domain. I really do owe him about a case of beer now. I have, with his guidance, set it up as a sub domain of my site. Once again, Ben ROCKS!

Once I get it all written up, I will have to post some details on the setup of MX records for Google Apps in GoDaddy as well as CNAME's. I am just having so much fun with all of this. Now off to the next setup and configuration task.

Monday, May 02, 2011

Disabling Account Creation In BugZilla

I don't know about anyone else, but I am one of those guys who likes to implement what security I can on the server(s) that I have. Recently I have been doing setup on a new machine and have setup BugZilla as my issue tracking software.

I know that plenty of people have plenty of suggestions as far as the different software's that are available for different tasks. I have gotten some earfuls from some of them asking "why the heck would you choose that?". Please know ahead of time that the software I am using, I have chosen because:

#1: It meets my needs
#2: I have either used it or played with it before and am comfortable with it.

I have nothing against other software's, I just have the stuff I like and I use it.

Ok, that said, I have installed Bugzilla on my new server and have it setup with an account for myself. Upon getting it to that point, I quickly decided that I did not want anyone just creating an account, so I looked into how to disable account creation by anyone and here is how to do it.

1. Log in as an Administrator
2. Go to: Administration->Parameters->User Authentication
3. Scan down to the bottom of the screen till you find 'createemailregexp'.
4. Clear out the value in the box
5. Client "Save Changes"

AFter that, log out and ensure that the button says "Login" in stead of "Create Account" and your all set. After that, in order to create an account, you will need to log in as the administrator.

Saturday, June 13, 2009

Wireless Printing - SUCCESS!!!

Up until today, the only printer we have is attached to my wife's Windows XP machine via its USB cable. If I wanted to print a document, which isn't all that often of a need here at home, I would just email the file to her and print it after saving it on her machine. That was a bit tedious, especially when she is on the computer and doing her thing. I don't really like to be a bother and disturb her.

Both of our machines are on the home wireless network and being a network, I wondered how difficult it would be to set up to print, wireless, to the printer attached to her machine. After doing a quick search on Google and a short bit or reading I did the following:

1. Set up file and printer sharing on the Windows XP machine. This was quite easy and walking through their wizard is recommended. Make sure that you have set up the following pieces of information:

Machine Name
Workgroup (I changed this from the default)

2. After setting up the sharing, I went to the specific printers settings and turned on its sharing. Make sure that you give the printer a name as you will need it.

3. I am using Ubuntu 9.04 so I went to System->Printing. Click on New. Once you do that, it will try and find machines. In the next box, I clicked on the Network Printer drop down and selected "Windows Printer via SAMBA".

In the options that appear to the right, you will need to enter the smb address in the following format:

smb://workgroup/machine_name/printer_name

After that, if you have authentication setup, you will need to enter it. I didn't, so I just hit verify and it said it found the printer and it was shared. Jackpot, so far so good. Next, click Forward.

4. Now is the search for drivers. You can do this blindly or be smart about it and do what I did. I have a Brother printer and the options you are provided at the top for selecting your printer are:

a. Select printer from database
b. Provide PPD file
c. Search for a printer driver to download

I figured I would search Google for a ppd file, so I entered the following into a Google search: brother dcp-7020 ppd file

Low and behold, the first link in the search was for the OpenPrinting Database. They basically told me all they knew about my printer and notes it had on it. The best piece though, was it told me which driver was recommended. So, I went to the Choose Driver screen, chose Brother and then Forward and on the next page selected the driver it recommended.

Wouldn't you know but it worked PERFECTLY!!! Isn't Linux just beautiful? :) I think (and know) so.

I hope this helps you setup your printer, wireless, on your own home network. I definitely see the value in print servers and network based printers, don't get me wrong, but when you are unemployed as I am and have no $$$, its awesome to be able to do what you need to, for free.

Sunday, March 23, 2008

Solaris 10 - Laptop: Update

I DID IT!! For the first time in the 10 years since I first touched Solaris Unix, I have Solaris on the internet....... WIRELESSLY!!! This is just excellent!! Solaris 10 x86 supports my Intel PRO/Wireless 2200 b/g wireless card perfectly!!

Granted, it wasn't a piece of cake and did take some tweaking, but it WORKS!!! For instance, I had to add an entry to the /etc/netmasks file, I had to create the resolv.conf file and I also had to edit the nsswitch.conf file to allow for dns.

Other than that, the software installed fine, plumbed ok, and grabbed an IP from my router. Only issue I have left, is when I reboot, it doesn't load the interface back up again. So, I have to re-plumb and grab an IP from dhcp. Hopefully I will figure that out shortly and be SET!!

Next, I have to install the driver for my Broadcom 10/100 card and I will be doing just fine!
 
Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.