Friday, February 20, 2015

Sftp only access

Create group:
sudo addgroup exchangefiles

Create directory Structure
# Create the chroot directory, it is important to make the directory owned by root and set proper permission otherwise chroot will not work.
sudo mkdir /home/exchangefiles/
sudo chmod 755 /home/exchangefiles/
# Create the group-writable directory
sudo mkdir /home/exchangefiles/files/
sudo chmod g+rwx /home/exchangefiles/files/
sudo chgrp -R exchangefiles /home/exchangefiles/file

/etc/ssh/sshd_config
#add Match directive at the end of this file
Match Group exchangefiles
# Force the connection to use SFTP and chroot to the required directory.
ForceCommand internal-sftp
ChrootDirectory /home/exchangefiles
# Disable tunneling, authentication agent, TCP and X11 forwarding.
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
Users from exchangefiles group can sftp into the system but can not ssh, and the / will change to /home/exchangefiles.

    Thursday, February 19, 2015

    sftp/ssh vis http_proxy

    sftp -o "ProxyCommand=/usr/bin/nc -X connect -x proxy_server:port %h %p" user@host 22

    Tuesday, May 13, 2014

    X forward qmon to linuxmint

    By default, qmon runs into error if you do x forward to a linuxmint. The reason for that is you are missing some x11 fonts. To solve the problem, you need to install
    xfonts-100dpi, xfonts-75dpi and gsfonts-x11
    on linuxmint and restart X.

    Friday, September 13, 2013

    IMAP setup for outlook.com

    For Thunderbird:
    IMAP server: imap-mail.outlool.com
    Port: 993
    Connection Security: SSL/TLS
    SMTP server: smtp.love.com or smtp-mail.outlook.com
    Port: 587
    Connection security: STARTTLS

    Monday, July 08, 2013

    Compression for tape drive

    change the default setting:
    sudo mt -f /dev/nst0 defcompression 0|1
    you can check the default setting by ‘cat /sys/class/scsi_tape/nst0/default_compression’
    You can overwrite this setting by ‘mt -f /dev/st0 compression 0|1′.

    Thursday, May 23, 2013

    gcc and make under Mac OS X

    The problem is that gcc and make are missing even after you install Xcode. The solution is that you need to install Command Line Tools by going XCode-> Preferences->Downloads-> and Install "Command Line Tools".

    Monday, April 08, 2013

    Images convertion between Qemu and VirtualBox

    VDI to QCOW:
    VBoxManage clonehd image.vdi image.img –format RAW
    qemu-img convert -f raw image.img -O qcow2 image.qcow2

    QCOW to VDI:
    qemu-img convert image.qcow2 -O raw image.raw
    VBoxManage convertdd image.raw image.vdi