Posted by admin on September 25, 2009 – 3:05 pm
Filed under WEB-DEV-LOG
Tagged as
Alternative Method
Instead of using the above method of dumping and reloading your data, you can use the ALTER TABLE/DATABASE SQL statements to convert your data.
For each table you want to convert to utf8, use the following statement.
ALTER TABLE
CONVERT TO CHARACTER SET utf8;
This will automatically convert all text columns to utf8.
To set the default character set for a database, use the following statement.
ALTER DATABASE CHARACTER SET utf8;
This does not affect any existing tables, but any future tables created in this database will use utf8 by default.
my.cnf
[client]
port = 3306
socket = mysql
default-character-set=utf8
[mysqld]
port = 3306
socket = mysql
skip-locking
init_connect=’SET collation_connection = utf8_general_ci’
init_connect=’SET NAMES utf8′
default-character-set=utf8
default-collation=utf8_general_ci
character-set-server = utf8
collation-server = utf8_general_ci
[mysql]
default-character-set=utf8
Posted by admin on September 25, 2009 – 1:58 pm
Filed under WEB-DEV-LOG
Tagged as
link
Modify /usr/local/etc/sshd_config to include the following lines (your environment may vary):
# Use the following line to *replace* any existing ‘Subsystem’ line
Subsystem sftp internal-sftp
# These lines must appear at the *end* of sshd_config
Match Group sftponly
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no
This means that all users you add to the ‘sftponly’ group will be chroot’d to their home directory, and will only be able to run the internal SFTP process.
Create a new user group to add users to (this determines whether they are chroot’d or not), using groupadd sftponly.
Now, configure your users’ accounts as follows (don’t forget to do this with new users as well):
* Set their group (usermod -g) to sftponly (the group you created in the previous step)
* Set their shell (usermod -s) to /bin/false (to deny them shell access)
* Set their home directory (usermod -d) as you prefer
* Important (OpenSSH tests for this condition): ensure their home directory is owned by root, and is not writable by any other user or group. This must also be the case for each directory in the path up to the root of your system.
* Ensure the default UMASK is set appropriately – I found my users got confused if their files didn’t automatically set themselves to rwxr-xr-x (755), so I added CMASK=022 to /etc/default/login
Test the setup (you will probably need to HUP your SSH daemon first, or start it up if it isn’t already). Use sftp username@hostname.org and make sure you can’t change directory out of the chroot’d environment. Also check access is denied when using ssh
Posted by admin on September 25, 2009 – 1:29 pm
Filed under WEB-DEV-LOG
Tagged as
supports SFTP
perk regular expression to delete blank lines ^\s*[\r\n]+