Pages

Friday, May 27, 2011

Practical Use Note of Gammu

# Installing Gammu
apt-get install gammu

# Connecting The Modem
after the modem is plugged in,
find that the modem is detected with: dmesg | grep tty
ussually if the interface is USB, it'll shows ttyUSB0 and ttyS0 for serial, you'll need this for configuring gammu next..

# Configure Gammu
vi /etc/gammu-smsdrc

# Check It
please make sure that gammu service is not active.
root@pcsimv:~# gammu --identify
Device : /dev/ttyS0
Manufacturer : Wavecom
Model : unknown (MULTIBAND 900E 1800)
Firmware : 657e09gg.Q24PL002 1961548 103107 17:56
IMEI : 353044020053022
SIM IMSI : 510104242000009

# Starting the Service
root@pcsimv:~# /etc/init.d/gammu-smsd0 start
* Starting Gammu SMS Daemon gammu-smsd0 Log filename is "/var/log/smsdlog"
[ OK ]
# Checking log
vi /var/log/smsdlog

Tuesday, May 24, 2011

Delete Local Storage Repository on xenServer

While this can be done by XenCenter (see XenCenter's help section), there are other way to do it:

1. First, you have to determine the Storage-Repository-UUID:

xe sr-list

-> write down / take note of SR-UUID of the SR to delete

2. Find the corresponding Physical Block Device (PBD):

xe pbd-list sr-uuid=your-SR-uuid

-> write down / take note of PBD-UUID of the PBD to unplug and delete

3. Unplug the PBD:

xe pbd-unplug uuid=your-PBD-uuid

4. Delete PBD:

xe pbd-destroy uuid=your-PBD-uuid

5. Delete the association of your SR and the PBD:

xe sr-forget uuid=your-SR-uuid

Thursday, May 19, 2011

Ubuntu SSH login delay

this is the trick:

vi /etc/ssh/sshd_config

then add:

UseDNS no

Save & reload SSH

Using Samba on Ubuntu

Configure: https://help.ubuntu.com/6.06/ubuntu/serverguide/C/configuring-samba.html

smbpasswd -a jseinfeld
  1. sudo apt-get install smbfs smbclient
  2. smbclient -L 192.168.1.2 -U%
  3. smbmount //192.168.1.2/Music /home/dbott/music -o username=dbott,password=mysecretpassword,uid=1000,mask=000
  4. smbumount /home/dbott/music
  5. adding in fstab (unsecure): //192.168.1.2/Music /home/dbott/music smbfs auto,username=dbott,password=mysecretpassword,uid=1000,umask=000,user 0 0
  6. adding in fstab (secure): //192.168.1.2/Music /home/dbott/music smbfs auto,credentials=/root/.credentials,uid=1000,umask=000,user 0 0
  7. gedit /root/.credentials
  8. and add the following text:
  9. username=your_smb_username
  10. password=your_smb_password
  11. Now, make the file only readable by root:
  12. sudo chmod 600 /root/.credentials
  13. At this point, you can either reboot or reload your fstab:
  14. sudo shutdown -r now
  15. sudo mount -a

ufw - The Uncomplicated Firewall on Ubuntu

ufw - Uncomplicated Firewall

The default firewall configuration tool for Ubuntu is ufw. Developed to ease iptables firewall configuration, ufw provides a user friendly way to create an IPv4 or IPv6 host-based firewall.

ufw by default is initially disabled. From the ufw man page:

ufw is not intended to provide complete firewall functionality via its command interface, but instead provides an easy way to add or remove simple rules. It is currently mainly used for host-based firewalls.

The following are some examples of how to use ufw:

  • First, ufw needs to be enabled. From a terminal prompt enter:

    sudo ufw enable 
  • To open a port (ssh in this example):

    sudo ufw allow 22 
  • Rules can also be added using a numbered format:

    sudo ufw insert 1 allow 80 
  • Similarly, to close an opened port:

    sudo ufw deny 22 
  • To remove a rule, use delete followed by the rule:

    sudo ufw delete deny 22 
  • It is also possible to allow access from specific hosts or networks to a port. The following example allows ssh access from host 192.168.0.2 to any ip address on this host:

    sudo ufw allow proto tcp from 192.168.0.2 to any port 22 

    Replace 192.168.0.2 with 192.168.0.0/24 to allow ssh access from the entire subnet.

  • Adding the --dry-run option to a ufw command will output the resulting rules, but not apply them. For example, the following is what would be applied if opening the HTTP port:

     sudo ufw --dry-run allow http 
    *filter :ufw-user-input - [0:0] :ufw-user-output - [0:0] :ufw-user-forward - [0:0] :ufw-user-limit - [0:0] :ufw-user-limit-accept - [0:0] ### RULES ###  ### tuple ### allow tcp 80 0.0.0.0/0 any 0.0.0.0/0 -A ufw-user-input -p tcp --dport 80 -j ACCEPT  ### END RULES ### -A ufw-user-input -j RETURN -A ufw-user-output -j RETURN -A ufw-user-forward -j RETURN -A ufw-user-limit -m limit --limit 3/minute -j LOG --log-prefix "[UFW LIMIT]: " -A ufw-user-limit -j REJECT -A ufw-user-limit-accept -j ACCEPT COMMIT Rules updated 
  • ufw can be disabled by:

    sudo ufw disable 
  • To see the firewall status, enter:

    sudo ufw status 
  • And for more verbose status information use:

    sudo ufw status verbose 
  • To view the numbered format:

    sudo ufw status numbered 
[Note]

If the port you want to open or close is defined in /etc/services, you can use the port name instead of the number. In the above examples, replace 22 with ssh.

This is a quick introduction to using ufw. Please refer to the ufw man page for more information.


Source: https://help.ubuntu.com/10.04/serverguide/C/firewall.html

Wednesday, May 18, 2011

Fat-16 drive will only allow a little over 500 files in one directory

According to Wikipedia:
Quote:
The number of root directory entries available is set at formatting time, and is stored in a 16-bit signed field setting an absolute limit of 32767 entries (32736, a multiple of 32, in practice). For historical reasons, FAT12 and FAT16 media generally use 512 root directory entries on non-floppy media, and other sizes may be incompatible with some software or devices (entries being file and/or folder names in the old 8.3 format).[9] Some third party tools like mkdosfs allow the user to set this parameter.[10]
Thus, my Fat-16 drive will only allow a little over 500 files in one directory.