How to create a swap file:
- Use SSH and login into your Pogoplug
- /opt/bin/ipkg install e2fslibs
- dd if=/dev/zero of=/tmp/.cemnt/mnt_sda1/swapfile.img bs=1M count=512 #for a 1GB swapfile, use count=1024
- /opt/sbin/mkswap /tmp/.cemnt/mnt_sda1/swapfile.img
- /opt/sbin/swapon /tmp/.cemnt/mnt_sda1/swapfile.img
- /opt/bin/nano /etc/init.d/rcS
- Add the line from step 4 before Samba starts up (if already installed) or at the end, and save the file.
- Exit out of nano after saving
A few notes about the swap file:
- I would highly recommend creating the swap file on an actual hard drive and not on flash memory (aka USB or flash drives), because swap files may prematurely exhaust your flash drive's limited write cycles.
- 512MB swap file should be more than ample, due to the fact that that the Pogoplug's RAM is only 128MB and having it at 1GB will not provide any additional benefit.
How to install Samba v3.6:
Assuming you are still in the same SSH session, if not reconnect and login as root, please follow these instructions a precisely as you can. I am working on the assumption that you have already formatted your hard drives as ext3 (except for the ext2 system drive that you use to install your Optware packages in /opt); if not then, I would recommend searching for sites with info on how to do that. The reason for ext3 is the journaling feature that helps reduce the risk of data corruption in the event of a power outage. I am also assuming that you have already added users to your your Pogoplug via the adduser command and have configured their home directories to be as such: /tmp/.cemnt/mnt_sda1/user1 in the /etc/passwd file. The reason for this to not only simplify the administration of Samba, but to also increase security to a limited degree.
- /opt/bin/ipkg install samba36
- Once it is installed, you will now have to configure using your favorite text editor, I prefer nano, but feel free to use which ever one you like: /opt/bin/nano /opt/etc/samba/smb.conf
- You can copy and paste the configuration file below; however, please edit the entries to match your Pogoplug's configuration:
# sample samba 3.0 conf file
[global]
log level = 1
log file = /opt/var/log/samba/log.%m
printcap name = /dev/null
load printers = no
printing = bsd
# CHANGE these settings to match your network/workgroup setup
# ------------------
workgroup = WorkgroupName
server string = ServerName
# netbios name = usbdrive
# your wins server ip address
# wins server = 10.0.0.1
# the networks you want to allow connections from
hosts allow = 127.0.0.1 192.
hosts deny = 0.0.0.0/0
# ------------------
config file=/opt/etc/samba/smb.conf
os level = 8
load printers = no
max log size = 10
security = user
encrypt passwords = yes
smb passwd file = /opt/etc/samba/smbpasswd
socket options = TCP_NODELAY SO_KEEPALIVE SO_SNDBUF=16384 SO_RCVBUF=16384
preferred master = no
local master = yes
dns proxy = no
preserve case = yes
short preserve case = yes
default case = upper
case sensitive = no
mangled names = yes
# null passwords = yes
# username map =
dos filetimes = yes
force directory mode=771
force create mode=660
create mask=771
# map system=yes
map to guest=Bad User
guest account = root
guest ok = no
bind interfaces only = yes
# interfaces = ixp0 lo
winbind use default domain = no
[user1]
path = /tmp/.cemnt/mnt_sda1/user1
valid users = user1
public = no
writable = yes
- Save the file and exit out of the text editor.
- Edit the rcS file with your favorite text editor (e.g. /opt/bin/nano /etc/init.d/rcS) and add the following lines in the order as they appear:
sleep 20
mount -o exec,remount /tmp/.cemnt/mnt_sda1
mount /tmp/.cemnt/mnt_sda1 /opt
/opt/sbin/swapon /tmp/.cemnt/mnt_sda1/swapfile.img
/opt/etc/init.d/S08samba start
mount -o exec,remount /tmp/.cemnt/mnt_sda1
mount /tmp/.cemnt/mnt_sda1 /opt
/opt/sbin/swapon /tmp/.cemnt/mnt_sda1/swapfile.img
/opt/etc/init.d/S08samba start
- Save the file and exit out of the text editor. This will make sure that your Pogoplug will start your swap file and Samba services every time it boots.
- to start Samba, just type in the following command: /opt/etc/init.d/S08samba start
- Add user accounts to Samba that are stated within the smb.conf file by issuing the following command with the corresponding user account name followed by the user's password: /opt/bin/smbpasswd -a username
Troubleshooting Samba v3.6:
If you are running into problems with your Samba shares, it will likely be due to on of the following issues:
- Misconfiguration in the smb.conf file
- Failed to use an Ext2 or Ext3 (Recommended) file system for your Samba shares
- Failed to apply the proper permissions (remember the configuration above is meant for user security)
- If you have problems editing your /etc/init.d/rcS file (e.g. read-only file system) try this command: mount -o remount,rw /
- Your drive has data corruption, which can be resolved by logging in as root and running the following command on the affected drive: (ext2) /opt/sbin/e2fsck /tmp/.cemnt/sda1 for (ext3) /opt/sbin/e2fsck -t /tmp/.cemnt/sda1
For problem 1, check your log files and verify that everything is correct. One common mistake is not taking into account that your Pogoplug may have your users shares on /tmp/.cemnt/mnt_sdb1 instead of sda1. As they say Google is your friend.
For problem 2, you can either search for instructions on how to create an Ext3 partition, or you can connect your drive to your Windows computer and format it with Ext3 using the EaseUS Partition Master Home Edition software, which happens to be free :-)
For problem 3, which happens to be a very common issue. First check your permissions on each user's shared directory (e.g. /tmp/.cemnt/mnt_sda1/user1) and verify that they have the following permissions, like the example below by peforming ls -l /tmp/.cemnt/mnt_sda1/ command:
drwxr-xr-x 4 user1 1000 4096 Nov 10 12:00 user1
If it says root for the user-id and you do not have at least 700 permissions (e.g. drwxr------), then perform the following commands for each user (you can find the user's group numbers in /etc/passwd):
chmod 700 /tmp/.cemnt/mnt_sda1/user1
chown user1 /tmp/.cemnt/mnt_sda1/user1
chgrp 1000 /tmp/.cemnt/mnt_sda1/user1
greate, many thankz!!!
ReplyDeletei have one problem, mkswap is not found. swapon exists, but in /sbin/ and not in /opt/sbin/
any help?
ipkg install busybox
ReplyDeleteand move the /opt (s)bin and lib entries in your /etc/profile PATH export after the /usr ones