Swizzling.org

Welcome to swizzling kids. The site with no real purpose and shocking low levels of content.

ERROR: Unable to install the “plesk-base” package.

June 22nd, 2010 . by Dave

This message is an utter pain in the arse and as far as I can see the Plesk Panel installer doesn’t log anywhere. Correct me if I’m wrong!

Anyway it looks like MySQL is a dependency for the install process so install MySQL server and your laughing

yum install mysql-server -y

Simple NAS box with samba

November 26th, 2009 . by Dave
Here's a sample /etc/smb.conf I use when I need to deploy a nice simple NAS box.
Start a nice simple distro, I like CentOS myself.
Install samba
# yum install samba

Create a new system user and set a password. This user is used for ownership and permissions of the shares presented by Samba.
# useradd nas-user
# passwd nas-user

Create a samba password for the new user
# smbpasswd -a nas-user

Create a directory somewhere for storage of files used by the samba share
# mkdir /storage1

Change ownership for the new directory to the new user. All files for the share will be owned by this user.
# chown nas-user:nas-user /storage1

Now edit /etc/samba/smb.conf

[global]
	workgroup = Sales-Department
	server string = "Some comment, visible only from network browser in Windows"
	netbios name = FileServer

	# Disable printers and faxes
	load printers = no
	disable spoolss = yes
	printcap name = /dev/null

	# Only allow connections from 192.168.1.0 subnet. Deny everything else
	hosts allow = 192.168.1.0/24
	hosts deny = 0.0.0.0/0

	security = user
	passdb backend = tdbsam

[backups-storage]
	comment = Storage for backups and archives
	path = /storage0
	force user = backups-user
	force group = backups-user
	read only = No
	guest ok = Yes

Now restart the samba service.
# service smb restart

Linux – Multiple FTP users, same directory, different permissions.

April 1st, 2009 . by Dave

Recently somebody asked me how to have a few users able to access the same directory over FTP. But only allow some of them to have read-write access, and let the rest be read-only.

I use vsftp which needs to be modified a little bit for this to work.

edit /etc/vsftp/vsftpd.conf   (on CentOS, your distro may store the .conf somewhere else)

You’ll need to change “local_umask” from 022 to 0007. Save and restart the service

/etc/init.d/vsftpd restart

# Add 2 new groups, one for read only users and the other will be for the read-write guys

groupadd ftp-readonly
groupadd ftp-readwrite

# Create a document store where all FTP users will access once they are logged in. always a good idea to put it in /home

mkdir /home/ftp-docs
chmod 775 /home/ftp-docs/
chown root:ftp-readwrite /home/ftp-docs

# Add the new users

useradd -g ftp-readwrite -d /home/ftp-docs user1
useradd -g ftp-readwrite -d /home/ftp-docs user2
useradd -g ftp-readonly -d /home/ftp-docs user3

# Set the users password

passwd user1
passwd user2

And your done.

The reason you need to change the umask is when a new directory is created by a read-write user the permissions by default don’t give full write-write access, I believe it’s read-only (for other users in the group).

So user1 can create a directory but only user1 can remove it.

CentOS Persistent Static Routes

March 21st, 2009 . by Dave

For each device create the file /etc/sysconfig/network-scripts/route-eth0   (eth0 in this example)

One line per static route please:

10.10.2.0/24 via 192.168.1.2 dev eth0

10.10.1.0/24 via 192.168.1.2 dev eth0

service network restart

Clone disk over SSH

December 13th, 2008 . by Dave

This is pretty handy. It will make an exact copy of a disk on your local machine to a disk on a machine anywhere running Linux with an SSH server running.

Because we’re playing with filesystems I strongly recommend you only do this when both machines are booted off live CD’s. Trying to do a disk dump of a mounted volume is the doings of a mad man and will surely end up in data curruption.

dd if=/dev/sda ibs=32k obs=2k | ssh root@192.168.1.10 “dd of=/dev/sda obs=32k”

This will dump the content of your local disk, /dev/sda to a local disk on a remote machine, also /dev/sda in this case.

You will need root access on the remote machine.

I find this will very useful when migrating virtual machines where you can be sure the hardware on source and destination machines are the same.

« Previous Entries