Allow SFTP but disallow SSH?

Starting with version 4.9 OpenSSH (not available in centos 5.x but ChrootDirectory feature was backported) has an internal-sftp subsystem: Subsystem sftp internal-sftp And then block other uses: Match group sftponly ChrootDirectory /upload/%u X11Forwarding no AllowTcpForwarding no AllowAgentForwarding no ForceCommand internal-sftp Add your users to the sftponly group. The chroot directory must be owned by root, … Read more

Linux command line best practices and tips?

Use screen, a free terminal multiplexer developed by the GNU Project that will allow you to have several terminals in one. You can start a session and your terminals will be saved even when you connection is lost, so you can resume later or from home.

REJECT vs DROP when using iptables

As a general rule, use REJECT when you want the other end to know the port is unreachable’ use DROP for connections to hosts you don’t want people to see. Usually, all rules for connections inside your LAN should use REJECT. For the Internet, With the exception of ident on certain servers, connections from the … Read more

How can I rename a Unix user?

Under Linux, the usermod command changes user names. It modifies the system account files to reflect the changes that are specified on the command line. To change just the username: usermod –login new_username old_username To change the username and home directory name: usermod –login new_username –move-home –home path_to_the_new_home_dir old_username You may also want to change … Read more

Postfix – how to retry delivery of mail in queue?

According to postqueue(1) you can simply run postqueue -f to flush your mail queue. If the mails aren’t delivered after flushing the queue but are being requeued instead, you might want to check your mail logs for errors. Taking a peek at postsuper(1) might also be helpful. Maybe the messages are on hold and need … Read more

How to copy file preserving directory path in Linux?

The switch you need is –parents, e.g.: jim@prometheus:~$ cp –parents test/1/.moo test2/ jim@prometheus:~$ ls -la test2/ total 42 drwxr-xr-x 3 jim jim 72 2010-09-14 09:32 . drwxr-xr-x 356 jim jim 43136 2010-09-14 09:32 .. drwxr-xr-x 3 jim jim 72 2010-09-14 09:32 test jim@prometheus:~$ ls -la test2/test/1/.moo -rw-r–r– 1 jim jim 0 2010-09-14 09:32 test2/test/1/.moo

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)