Friday, July 18, 2008

chmod-Change Access Permissions of a File or Directory

Synopsis
chmod [ -fR] mode pathname ...
Description
chmod changes the access permissions or made of the specified files or directories.Modes determine who can read, change or execute a file.
Options
the -R option can be used when a directory is specified on the command line. chmod will give all subdirectories and files under that directory the attributes specified for the directory itself.
the -f option forces chmod to return a succesful status and no error messages, even if errors are encountered.this is useful if you're using -R to change a lot of files but you don't really care if chmod changes everything, provided that it change a particular subset of the files.
Modes
The mode value on the command line can be spesified in symbolic form or as an octal value.
A symbolic mode has the form
[who] op permission [op permission ...]
the who value can be any combination of the following:
u sets user (individual) permissions
g sets group permissions
o sets other permissions
a sets all permissions;this is the default
On DOS, there are no group or other permissions. therefore, they always match the individual permissions.
the op part of a symbolic mode is an operator telling whether permissions ahould be turned on or off


Export Proxy on Konsole/Terminal

If you are under a proxy server, and want to access net using http or ftp through Konsole/Terminal, you will need to export http_proxy/ftp_proxy variables. One simple way to do so is that you type the following 2 commands :

$export http_proxy="http://username:password@proxyserver:proxyport"
$export ftp_proxy="http://username:password@proxyserver:proxyport"

You will need to replace “username”, “password”, “proxyserver” and “proxyport” with appropriate values.

But this way, you will see your password as well. And if you are with your friends, they can see the password as well. To solve this problem, you can use this small script. In “/etc/bash.bashrc” append these lines :

function proxy(){
echo -n "username :"
read -e username
echo -n "password :"
read -es password
export http_proxy="http://$username:$password@proxyserver:proxyport/"
export ftp_proxy="http://$username:$password@proxyserver:proxyport/"
echo -e "\nProxy variables set."
}

You will need to replace “proxyserver” and “proxyport” with appropriate values. Thats it. Now whenever you need to export the variables, just type “proxy” and press enter. It will ask you for your username and passwd. And will do the rest by itself.

How to use SSH :: A basic step-by-step guide

There are a couple of ways that you can access a shell remotely on most Linux/Unix systems. SSH, which is an acronym for Secure SHell, was designed and created to provide the best security when accessing another computer remotely. Not only does it encrypt the session, it also provides better authentication facilities as well as features like X session forwarding, port forwarding and more so that you can increase the security of other protocols. It can use different forms of encryption ranging anywhere from 512 bit on up to as high as 32768 bits.

Simple connect

The first thing we'll do ijavascript:void(0)
Publishs simply connect to a remote machine. This is accomplished by running 'ssh hostname' on your local machine. The hostname that you supply as an argument is the hostname of the remote machine that you want to connect to. By default, ssh will assume that you want to authenticate as the same user you use on your local machine. To override this and use a different user, simply use username@domain.com as the argument:

ssh username@domain.com

example:
my username : iyanux
my domain : 10.10.3.205

ssh iyanux@10.10.3.205

The first time around, it will ask you if you wish to add the remote host to a list of known_hosts, go ahead and say yes.


X11 session forwarding
You can login to a remote desktop machine and run some X windows program like Gnumeric, Gimp or even Firefox and the program will run on the remote computer, but will display its graphical output on your local computer. The key to making it work is using the -X option, which means "forward the X connection through the SSH connection"

ssh -X username@domain.com

and run the application from the remote console. If you get a "DISPLAY is not set" error, it means that sshd isn't configured to accept session forwarding. To enable this, open /etc/ssh/sshd_config in a text editor and uncomment (or add) the following line:

X11Forwarding yes


TCP Port Forwarding

Like X11 session forwarding, SSH can also forward other TCP application level ports both forward and backwards across the SSH session that you establish. For example, you can setup a port forward for your connection from your home machine to work.company.com so that it will take connections to localhost port 3306 and forward them to the remote side mysql.company.com port 3306.

ssh -L 3306:mysql.company.com:3306 username@work.company.com

where -L is the local port. Again, the option AllowTcpForwarding yes should be enabled in sshd_config.

You can also reverse the direction and create a reverse port forward. This can be useful if you want to connect to a machine remotely to allow connections back in. For instance, I use this sometimes so that I can create a reverse port 22 (SSH) tunnel in order to reconnect through SSH to a machine that is behind a firewall once I have gone away from that network:

ssh -R 8022:localhost:22 username@my.home.ip.address

This will connect to my home machine and start listening on port 8022 there. Once I get home, I can then connect back to the machine I created the connection from, using the following command:

ssh -p 8022 username@localhost


SOCKS5 proxy

You can set a SOCKS5 proxy similar to port forwarding, except you don't have to specify the address that you want to forward to:

ssh -D 1324 username@domain.com


Run commands over SSH

Sometimes, you don't really want to run a shell like Bash on the host you are connecting to. Maybe you just want to run a command and exit. So simply run:

ssh username@domain uptime

and it will print the current time, uptime, users and so on.


Keep SSH connection alive

If for whatever reason, your session just dies after X minutes of inactivity (idle), you can simply fix this problem by adding the following lines to ~/.ssh/config :

Host *
Protocol 2
ServerAliveInterval 60

This tricks many firewalls that would otherwise drop the connection to keep your connection going.

Thursday, July 17, 2008

How to install Application in ubuntu

Step 1
you must install built-essential
#apt-get install built-essential

Step 2
#make
Step 3
if your application tar.gz, you must ekstrak and then
#./configure
Step 4
#make install
finish

New Ubuntu Sources List

### sources.list.kambing
### Repository with server mirror kambing.vlsm.org(indoneisia)
## main repository
deb http://kambing.vlsm.org/ubuntu hardy main restricted universe multiverse
deb-src http://kambing.vlsm.org/ubuntu hardy main restricted universe multiverse

## this is for MAJOR BUG FIX UPDATES
deb http://kambing.vlsm.org/ubuntu hardy-updates main restricted universe multiverse
deb-src http://kambing.vlsm.org/ubuntu hardy-updates main restricted universe multiverse

## this is for UBUNTU SECURITY UPDATES

deb http://kambing.vlsm.org/ubuntu hardy-security main restricted universe multiverse
deb-src http://kambing.vlsm.org/ubuntu hardy-security main restricted universe multiverse

### sources.list.gamaisitb
### Repository with server mirror gamais.itb.ac.id

## main repository
deb http://mirror.gamais.itb.ac.id/ubuntu hardy main restricted universe multiverse
deb-src http://mirror.gamais.itb.ac.id/ubuntu hardy main restricted universe multiverse

## MAJOR BUG FIX UPDATES
deb http://mirror.gamais.itb.ac.id/ubuntu hardy-updates main restricted universe multiverse
deb-src http://mirror.gamais.itb.ac.id/ubuntu hardy-updates main restricted universe multiverse

## UBUNTU SECURITY UPDATES
deb http://mirror.gamais.itb.ac.id/ubuntu hardy-security main restricted universe multiverse
deb-src http://mirror.gamais.itb.ac.id/ubuntu hardy-security main restricted universe multiverse