.htaccess

14 09 2008

So after I made my music available in my web root, I felt it necessary to password protect it. I don’t want anyone to download my music or stream it or anything like that. No one except me, that is. No illegal activity should be coming from my server I figured. So I thought of the most basic way to do it which was htaccess.

Basically, you create a file called .htaccess with certain parameters. Here’s mine:

AuthType Basic
AuthName "Music"
AuthUserFile /var/.htpasswd
require valid-user

I’m not exactly sure what

AuthType

is, but

AuthName

is whatever you wanna call the folder you’re protecting. It doesn’t change the folder name, this is just what shows up in the little login window that pops up when you navigate to this folder.

AuthUserFile

is where the .htpasswd file is stored. The .htpasswd file specifies which user and password combinations are allowed to access this folder.

require valid-user

just lets it know that any valid user specified within the .htpasswd file is required for access.

In .htpasswd, each individual user should have his own line, and username and password should be seperated by a colon. i.e.

username:password
username:password

Finally, in your apache settings, specifically if you’re using Ubuntu the file will be located at /etc/apache2/sites-available/default. Find the line

AllowOverride None

and change it to

AllowOverride All

Advertisements




Worth a mention

10 09 2008

Well, this is kind of short, but I got wordpress loaded on the server. I was having trouble accessing the MySQL database. What happened was, I forgot the password I originally set for the root user, and thought I could just use my username and password. So all I had to do was reinstall MySQL and actually remember what the password was this time. I assume you already know how to install wordpress. If not there are plenty of help topics on it.

I know there is a command for resetting the MySQL root user password, I just forgot what it is.





External HDD

9 09 2008

So the most recent thing I’ve done is add on a 1TB external hard drive. This will be where basically all media such as photos and videos and music will be stored to be shared with the family.

When I first plugged in the drive, I couldn’t even move files on and off it. I wasn’t sure what was wrong, but eventually found out you have to make it your own. So you chown it by doing the following:

sudo chown -R user.user mountpoint

Where user is replaced with you username, in my case muzak, and mountpoint replaced with the location where the drive is mounted, in my case /media/disk.

This should’ve worked, only it didn’t. The problem was that the disk was using the FAT32 filesystem, which doesn’t support permissions. So basically what I had to do was reformat it. I opened up gparted,

sudo gparted

Navigated to the external disk and unmounted and reformatted it to ext3. After that I unplugged the disk and plugged it back in, ran the same command and everything was great.

Another way you can modify the permissions is to enter

sudo "filemanager"

filemanager being whatever you use to manage your filesystem, in my case dolphin. It will open up the filesystem, but you’ll be treated as the root user. You can now right click where the drive is mounted, in my case /media/disk, and click on the permissions tab. This is the thread where I got all my help from.





Let’s kick things off (VSFTPD)

8 08 2008

To start:
~Everything is installed on a Dell PowerEdge 2850 web server
~I installed Ubuntu 8.04 LTS Server Edition. You can download or request a CD be sent to you for free at http://www.ubuntu.com
~I plan on making this a ftp, LAMP, print, and mail server.

After downloading and installing Ubuntu, I thought it would be a good idea to install some sort of GUI, since I am not very knowledgeable in command line operating systems, and I did not feel like spending all the time learning. I decided to go with kubuntu. To install this I just had to enter the command:

sudo apt-get install kubuntu-desktop

Now that I had a GUI, it was time to get started. I figured the easiest thing to do would be to install the ftp client. It seemed pretty basic, and would allow me to back up other computers onto the server right away. I decided to go with vsftpd as this was said to be a reliable and light yet flexible client. To install this I entered the following command.

sudo apt-get install vsftpd

After a long time of trying to customize the config file myself, I was at the end of my fuse. I knew there had to be an easier way. So I searched a little bit on the internet and came accross Webmin. You can read more about what it is on the website, but basically it’s an easy way to manage various aspects of your server. This was pretty much exactly what I was looking for. I downloaded and installed it using this site as a guide.

Now that I had Webmin installed, I noticed it did not come with a module for vsftpd. Luckily someone had made one. Using this site as a guide, I was able to get it up and running.

The issue I was having with vsftpd was with security. I knew there were ways to lock users to their own folders and to create virtual users and all that, but I just could not figure it out. The Webmin module helped me figure that out to some degree. I was able to jail all users to their home directories, but I was never able to figure out how to create the virtual users, and from what I could tell, the module was no help whatsoever. So I decided to not worry so much about the virtual part, and just create local users. So I went into Webmin, and clicked System>>Users and Groups, and selected create new a new user. I noticed vsftpd had already created a user called virtual belonging to a group it had also created, also aptly named virtual. So I figured the “virtual” group had all the right settings. I created my own users and specified where their home directories were to be at. Logins from different machines proved successful, and users were not allowed outside their directories. Everything was great.

The next thing I decided to tackle was VNC. Since I am leaving for school the 14th, I figured I probably wouldn’t be done with this server before then, so I thought it would be nice to be able to work on it remotely from about 760 miles away. The VNC which was already loaded on the system required you to send out an invitation to whomever you wanted to connect to the server. This invitation is only valid for one hour or one login, whichever comes first. So this would require someone to send me an invitation everytime I wanted to work on the server, one phone call and hassle too much. So I looked a little, and found a client which could be started from the terminal. It runs with a single password, so if I know the password and the host, I can connect. This seemed alright for my purposes. I could log into the computer using PuTTY, and execute the command to start the VNC. This site explained, in a clear and concise manner (4 steps), how to set up x11vnc. After installing the client, I simply had to log into my router and open ports 5800 and 5900.

That’s pretty much how far I’ve gotten so far. This is pretty much going straight past all the struggles and searching and straight to the successes. I know this will help someone, even if it’s just me again in the future.