Archive for the ‘Operating Systems’ Category

Unix-ish Commands I use Often

April 1st, 2009 | No Comments »
Posted by Aaron Reimann under Editing, Linux/Unix, Mac OSX, Web Development

Are you a web designer that sometimes need to SSH into a web site and make some changes but don’t know a Unix text editor?  Here are some basic commands that you might need.

Navigating in and out of directores:

To change directories:

pwd (shows you what directory you are in)

ls (lists all files)

cd www (gets you into the directory called www)

cd .. (gets you down one directory)

Editing files.  I like editing files in Vi.  It is confusing if you don’t know it.  I am by no means a Vi expert like some of my friends, but I can do a lot.  Here are the basics:

use the arrow keys to navigate (you can use letters to move around, but if you don’t want to learn Vi, don’t waste your time)

vi filename.php (opens a file called filename.php)

i (gets you in the insert mode)

the escape key gets you out of the insert mode

x (deletes the character your cursor is on)

dd (deletes the whole line you are on)

:w (writes the file)

:q (quits Vi)

:wq (writes the file and exists)

:%s:bob:john:g (replaces bob with john in the whole file, i recently used that to replace text on a 42 meg text file, it came in handy.  it took seconds to do)

Enjoy!

 

Mac OSX user lost desktop permissions

March 23rd, 2009 | No Comments »
Posted by Aaron Reimann under Mac OSX, Operating Systems

What do you do when all of your icons no longer appear on your desktop?  Chances are, you have lost all permissions to view (read) and edit (write) them.  This happened to one of my friends, he of course was a little confused.  We had no idea why it happened, but it did.  Let’s call this Joe Bob His Mac username is “Joe Bob” and the real user name (Unix name) is “joebob.”

The user, joebob, could access Application, his music (/Users/joebob/Music), his documents (/Users/joebob/Documents), etc. But was unable to access /Users/joebob/Desktop. He got a permission denied thing. I find that somewhat funny because there wasn’t any other user on the computer (well, besides, root, apacheh, mysql, etc). So, what was the fix?

Go to terminal (use Spotlight to find it if you want) and type in: sudo passwd

Typing that in “activates” the root account.  Make sure you remember the root password, you will not be happy if you forget it.

How do get your “short name”, type in:

cd /Users

ls

What are short names?  Even though when I login to my Mac my user name “Aaron Reimann” is displayed, I can still login as “aaronr”.  OSX (and a lot, maybe all Unix-like OS’s) creates a short name for every user that it creates.  It makes more sense that your user directory is “/home/aaronr”, not “/home/Aaron Reimann”.  I don’t know if it is a POSIX thing or not, it is a fact though.

now type in: sudo chown -R joebob:joebob /Users/joebob/Desktop

That will make sure that joebob owns the Desktop directory

type in: sudo chmod -R 744 /Users/joebob/Desktop

That will make the files on the desktop read and writable

Log off, log back in, and you will see your icons/files.

With all that said, you probably could go into Disk Utilities and do it the “easy” (really the time consuming and GUI way), but this is quick.

 

Migrating a users and files to a new Linux Box

March 17th, 2009 | No Comments »
Posted by Aaron Reimann under Linux/Unix, Operating Systems

The purpose of this article is to show you how simple it is to migrate your system to a new server in case you have a need to upgrade. This is not for the people that are not familiar with Linux. You need to know, for example, that if it is a web server, make sure you get the Apache configs. I wanted to move users, passwords, samba users, samba passwords and home directories to the new box. Here is what I did.

This tutorial should work for any version of Fedora, and really, should work for Linux boxes in general. This should teach you the concept more than anything.

Box 1: This is the original box that I setup a long time ago. It is running Fedora Core 6, with the latest updates. The IP of the box is 192.168.0.11. I transferred users, passwords, groups, Samba configs and users’ home directories from this box

Box 2: Fresh (very simple) installation of Fedora Core 6 with the latest updates. I installed Samba, if you need Apache, go ahead and install that on the new box. Make sure you have the latest updates on both! Give it whatever IP address, I used DHCP and it got 192.168.0.115.

DO NOT CREATE A USER (besides root) ON THE NEW BOX and once your new box has installed Fedora, do not login (might be overkill, but I would take the chance.

Let’s start:

Move users/passwords/groups/shadow/Samba configs to the new box:

tar -cf – /etc/passwd | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/passwd- | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/shadow | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/shadow- | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/group | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/group- | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/sudoers | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/samba | ssh 192.168.0.115 tar -xf – -C /

Now copy over users home dirs (It can take hours depending on amount of data):
tar -cf – /home | ssh 192.168.0.115 tar -xf – -C /

Now copy over root’s home dir if you want:
tar -cf – /root | ssh 192.168.0.115 tar -xf – -C /

That’s it. You don’t even need to reboot.

Now grab whatever configs you think you will need. Do not toss that old box….keep it around for a while. You want to make sure that you have all of the files off that you need. You might need your Apache configs, php.ini, and /etc/hosts.

Now change your IP address of your new box to what your old box was. In *theory* no one will tell the difference, except file transfers will be faster.

Feel free to contact me if you want

 

Why do people still use FTP?

February 20th, 2009 | No Comments »
Posted by Aaron Reimann under Linux/Unix, Web Development

FTP is a security nightmare, and no one should ever use it if the server is on the internet.

Why isn’t it secure you ask?  When people go to Facebook, Amazon, eBay, etc., they are safe because the data that is transferred is encrypted.  So if someone is snooping on the network (like at a coffee shop) they won’t see every letter you are typing being transferred.

FTP on the other hand has no encryption.  So if I am at a coffee shop and snooping on the network, I would get the password of someone if they login using FTP.  When you are on the internet though, everything is snoop-able (sp?).  So if you are at home, and I FTP into my web server, the username/password transfers through at least 10 networks before it finally hits the server.  Someone could be spooping at any point.

There are great options like FTPS (s = secure) and SSH.  I just setup “vsFTPd” on my Linux server and it is using SSL (secure socket layer).  It took less than 5 minutes.

If you are a web designer and have the option to use SSH, SFTP, FTPS, SSL, etc, use it.  Most clients now give you the option.

 
 
Theme by A. Reimann