One of my commercial project requires me to setup TRAC to manage the development phase. Hence, I need to secure my server that will host TRAC. I understand this is only basic but should be enough to start with.
Today, I will redirect the SSH to use other port. The idea behind it is that they way to login to the server needs IP Address (hostname), port number, username and password. IP Address/hostname you cannot do anything with this since this is the location of the server. Barebone VPS will use default values for port number (=22) and username (=root). There only left the password is unknown to the public. However, if we change the port number and not permitting root to login via ssh, instead using other user. We can DELAY people to get into your server. I said DELAY because it would be not too dificult to get the port number.
Step 1: login to your vps. I am using VPSFarm again. Check you email to get the password.
Step 2: Change the password to make it easier to you to remember but harder for other people to guess.
To access official Ubuntu documentation, please visit:http://help.ubuntu.com/
root@ubuntu-pristine:~# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@ubuntu-pristine:~#
Step 3: Add a new user specially for SSH connection, I would give it a name "onin".
root@ubuntu-pristine:~# adduser onin
Adding user `onin' ...
Adding new group `onin' (1000) ...
Adding new user `onin' (1000) with group `onin' ...
Creating home directory `/home/onin' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
password updated successfully
Changing the user information for onin
Enter the new value, or press ENTER for the default
Full Name []: Onin
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [y/N] y
root@ubuntu-pristine:~#
Step 4: Change SSH setting.
root@ubuntu-pristine:~# vim /etc/ssh/sshd_config
Set these values to:
Port 2987(change to your choiche, on mine it is on line #5 )
PermitRootLogin no (line #26)
X11Forwarding no (line #62)
UsePAM no (line #77)
AllowUsers onin (added new on line #78)
Step 4: Restart SSH server. Do not close this session, for backup connection if somehow your new ssh setting does not work.
a. Test to connect to the server again using old setting, result: does not work! (as expected).
b. Login to the server again to the port 2987 user "root": does not work! (as expected).
login as: root
root@ppa16.vpsfarm.com's password:
Access denied
c. Login to the server using port 2987 and user "onin" : WORKING (hurray!).
Step 5: Now, you are on the server. You have a choice to :
a. sudo su
b. create another user and give this user "admin" rights (the reason, ubuntu usually discourage you work as root and prefer we work using a user with admin rights):
root@ubuntu-pristine:~# su -l root
root@ubuntu-pristine:~# adduser cath
Adding user 'cath' ...
Adding new group 'cath' (1001) ...
Adding new user 'cath' (1001) with group `cath' ...
Creating home directory `/home/cath' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
password updated successfully
Changing the user information for cath
Enter the new value, or press ENTER for the default
Full Name []: Cath
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [y/N] y
root@ubuntu-pristine:~# visudo
The content of mine
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Uncomment to allow members of group sudo to not need a password
# %sudo ALL=NOPASSWD: ALL
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
cath ALL=(ALL) ALL <-- add "cath" to here!
I opt b) for future references. That's all for today. See you next time!
Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts
Wednesday, May 20, 2009
Friday, November 23, 2007
XAMPP 1.64 on Ubuntu
We know that Ubuntu server comes with a great support for LAMP, but for mobility issue, we can use XAMPP. However, I encountered a /bin/arch problem on my Gutsy. A quick search on Google, I found this link, http://jauhdimata.wordpress.com/2007/11/20/daripada-lupa/
Just in case something wrong with the link, I copied the solution here:
Just in case something wrong with the link, I copied the solution here:
/opt/lampp/lampp: line 74: arch: command not found
Starting XAMPP for Linux 1.6.3…
/opt/lampp/lampp: line 74: arch: command not found
/opt/lampp/lampp: line 74: arch: command not found
XAMPP: Starting Apache with SSL (and PHP5)…
/opt/lampp/lampp: line 74: arch: command not found
XAMPP: Starting MySQL…
/opt/lampp/lampp: line 74: arch: command not found
XAMPP: Starting ProFTPD…
XAMPP for Linux started.
add this file, /bin/arch by typing:% sudo vim /bin/arch
put this as the content of /bin/arch:
uname -m
then save and exit from vim by typing :wq
don't forget to make it executable by typing:
% sudo chmod +x /bin/arch
ok. now you can restart the xampp:
% sudo /opt/lamp/lampp restart
Sunday, November 4, 2007
Create Local Repo From DVD
1. Copy DVD contents to the folder in web server:
a. Preparing the folder, ie: /var/www/ubuntu, by doing $ sudo mkdir -p /var/www/ubuntu
b. Mount the DVD Repo to the /cdrom, $ sudo mount /cdrom
c. Copying the DVD Content to /var/www/ubuntu using rsync, $ sudo rsync -avx --progress /cdrom/. /var/www/ubuntu/.
d. Do (b) and (c) for all of your dvd repos.
2. Combine divided repo (ie: Gutsy)
a. Enter dvd repo #1, then mount it: $ sudo mount /cdrom
b. $sudo cp /cdrom/dists/gutsy/main/binary-i386/Packages /var/www/ubuntu/dists/gutsy/main/binary-i386/
c. eject the /cdrom, then do for dcd repo #2 $ sudo mount /cdrom
d. cat /cdrom/dists/gutsy/main/binary-i386/Packages >> /var/www/ubuntu/dists/gutsy/main/binary-i386/
should peemission denied, try: (don't forget to change back to 644)
$ sudo chmod 666 /var/www/ubuntu/dists/gutsy/main/binary-i386/
e. recreate the Packages.gz and Packages.bz
$ cd /var/www/ubuntu/dists/gutsy/main/binary-i386/
$ sudo rm Packages.gz Packages.bz2
$ sudo gzip -9 -c Packages > Packages.gz
$ sudo bzip2 -9 -c Packages > Packages.bz2
f. repeat for dvd #3, #4 and #5 for universe libraries.
3. That's all, you can activate it by adding:
deb http://[your-server-address]/ubuntu gutsy main restricted universe multiverse
a. Preparing the folder, ie: /var/www/ubuntu, by doing $ sudo mkdir -p /var/www/ubuntu
b. Mount the DVD Repo to the /cdrom, $ sudo mount /cdrom
c. Copying the DVD Content to /var/www/ubuntu using rsync, $ sudo rsync -avx --progress /cdrom/. /var/www/ubuntu/.
d. Do (b) and (c) for all of your dvd repos.
2. Combine divided repo (ie: Gutsy)
a. Enter dvd repo #1, then mount it: $ sudo mount /cdrom
b. $sudo cp /cdrom/dists/gutsy/main/binary-i386/Packages /var/www/ubuntu/dists/gutsy/main/binary-i386/
c. eject the /cdrom, then do for dcd repo #2 $ sudo mount /cdrom
d. cat /cdrom/dists/gutsy/main/binary-i386/Packages >> /var/www/ubuntu/dists/gutsy/main/binary-i386/
should peemission denied, try: (don't forget to change back to 644)
$ sudo chmod 666 /var/www/ubuntu/dists/gutsy/main/binary-i386/
e. recreate the Packages.gz and Packages.bz
$ cd /var/www/ubuntu/dists/gutsy/main/binary-i386/
$ sudo rm Packages.gz Packages.bz2
$ sudo gzip -9 -c Packages > Packages.gz
$ sudo bzip2 -9 -c Packages > Packages.bz2
f. repeat for dvd #3, #4 and #5 for universe libraries.
3. That's all, you can activate it by adding:
deb http://[your-server-address]/ubuntu gutsy main restricted universe multiverse
Sunday, August 12, 2007
unrar in ubuntu
sometimes we need to extract a file. zip or tar.gz files could be opened directly in linux, but rar is not supported. to be able extract a rar file, we should install unrar.
% sudo apt-get install unrar
two useful and most used command is
% unrar e your-file-name.rar #--- to extract the rar file in the current directory
% unrar l your-file-name.rar #-- to list the content of the rar file
% sudo apt-get install unrar
two useful and most used command is
% unrar e your-file-name.rar #--- to extract the rar file in the current directory
% unrar l your-file-name.rar #-- to list the content of the rar file
Wednesday, August 8, 2007
ubuntu: listing and removing packages
To view installed packages by size:
% dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | less
When you want to remove packages remember to use purge
% apt-get remove --purge package name
% dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | less
When you want to remove packages remember to use purge
% apt-get remove --purge package name
Sunday, July 29, 2007
grub in ubuntu
few days without a post as I was so anxious to wait for my teeth operation, so kids don't forget to brush your teeth. It was a small operation, but operation is an operation. the pain is real.
just a quick and lite tips today:
if you need to find out where is your grub menu option, look no further in
/grub/boot/menu.lst
usually after being updated by the system [for example after installing/upgrading to a new kernel], the old one will be save as /grub/boot/menu.lst~
just a quick and lite tips today:
if you need to find out where is your grub menu option, look no further in
/grub/boot/menu.lst
usually after being updated by the system [for example after installing/upgrading to a new kernel], the old one will be save as /grub/boot/menu.lst~
Tuesday, July 24, 2007
[fds part 1]: installing fedora directory server in ubuntu server 64-bit
1. download the fedora directory server (fds) from:
% wget http://directory.fedoraproject.org/download/fedora-ds-1.0.4-1.FC6.x86_64.opt.rpm
2. convert it to deb [--script was put there as it was warned by the system]:
% sudo alien fedora-ds-1.0.4-1.FC6.x86_64.opt.rpm --script
3. as it is amd64 version, we should use the termcap from fedora and do converting to deb again:
% wget http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/Fedora/RPMS/libtermcap-2.0.8-46.1.x86_64.rpm % sudo alien libtermcap-2.0.8-46.1.x86_64.rpm
% sudo dpkg -i libtermcap_2.0.8-47.1.amd64.deb
[deleted as it found to be false]Should 32 bit version is used, we could directly install it using:
% sudo apt-get install termcap-compat [upto here]
we should do:
% wget http://download.fedora.redhat.com/pub/fedora/linux/core/6/i386/os/Fedora/RPMS/libtermcap-2.0.8-46.1.i386.rpm
% sudo alien libtermcap-2.0.8-46.1.i386.rpm
% sudo dpkg -i libtermcap-2.0.8-47.1.i386.deb
4. We need Java, for feisty fawn you can do:
% sudo apt-get install sun-java6-bin
5. Setting JAVA_HOME enviroment variable:
% sudo vi /etc/profile
add these two lines on the last line:
JAVA_HOME=/usr/bin/java
export PATH JAVA_HOME
to make the modification take effect:
% . /etc/profile
test by
% echo $JAVA_HOME
/usr/bin/java [the expected output]
6. We also need apache:
% sudo apt-get install apache2-mpm-worker
as ubuntu recognize apache as apache and fedora recognize it as httpd, we need to create as symbolic link:
% sudo ln -s /usr/sbin/apache2 /usr/sbin/httpd
7. Installing the package:
% sudo dpkg -i fedora-ds_1.0.1-2_i386.deb
Creating a user and group for the daemon:
% sudo groupadd fds
% sudo useradd -s /bin/false -g fds fds
Next, setting up the server....
% wget http://directory.fedoraproject.org/download/fedora-ds-1.0.4-1.FC6.x86_64.opt.rpm
2. convert it to deb [--script was put there as it was warned by the system]:
% sudo alien fedora-ds-1.0.4-1.FC6.x86_64.opt.rpm --script
3. as it is amd64 version, we should use the termcap from fedora and do converting to deb again:
% wget http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/Fedora/RPMS/libtermcap-2.0.8-46.1.x86_64.rpm % sudo alien libtermcap-2.0.8-46.1.x86_64.rpm
% sudo dpkg -i libtermcap_2.0.8-47.1.amd64.deb
[deleted as it found to be false]Should 32 bit version is used, we could directly install it using:
% sudo apt-get install termcap-compat [upto here]
we should do:
% wget http://download.fedora.redhat.com/pub/fedora/linux/core/6/i386/os/Fedora/RPMS/libtermcap-2.0.8-46.1.i386.rpm
% sudo alien libtermcap-2.0.8-46.1.i386.rpm
% sudo dpkg -i libtermcap-2.0.8-47.1.i386.deb
4. We need Java, for feisty fawn you can do:
% sudo apt-get install sun-java6-bin
5. Setting JAVA_HOME enviroment variable:
% sudo vi /etc/profile
add these two lines on the last line:
JAVA_HOME=/usr/bin/java
export PATH JAVA_HOME
to make the modification take effect:
% . /etc/profile
test by
% echo $JAVA_HOME
/usr/bin/java [the expected output]
6. We also need apache:
% sudo apt-get install apache2-mpm-worker
as ubuntu recognize apache as apache and fedora recognize it as httpd, we need to create as symbolic link:
% sudo ln -s /usr/sbin/apache2 /usr/sbin/httpd
7. Installing the package:
% sudo dpkg -i fedora-ds_1.0.1-2_i386.deb
Creating a user and group for the daemon:
% sudo groupadd fds
% sudo useradd -s /bin/false -g fds fds
Next, setting up the server....
adding dvd repo in ubuntu server
using ubuntu server means no gui [no synaptic???]. in order to add dvd repo, do:
1. make sure the /cdrom is link to the correct cd/dvd rom being used.
% ls -l /cdrom
lrwxrwxrwx 1 root root 11 2007-07-24 12:25 /cdrom -> /media/cdrom
I put the dvd repo in /media/cdrom. Otherwise you should point to the right direction, for example:
% sudo rm /cdrom
% sudo ln -s /media/cdrom1 /cdrom # create symbolic link /media/cdrom1 as /cdrom
2. add the dvd repo by
% sudp apt-cdrom add
3. enter your password, then insert the dvd repo disk 1 and press enter.
4. do for the other three by repeating step 3 three times.
5. after that, don't forget to update the system using
% sudo apt-get update
Now, you have added dvd repo to your system, next time you wanna install software, you will be asked to insert a specific cd to where the software reside.
1. make sure the /cdrom is link to the correct cd/dvd rom being used.
% ls -l /cdrom
lrwxrwxrwx 1 root root 11 2007-07-24 12:25 /cdrom -> /media/cdrom
I put the dvd repo in /media/cdrom. Otherwise you should point to the right direction, for example:
% sudo rm /cdrom
% sudo ln -s /media/cdrom1 /cdrom # create symbolic link /media/cdrom1 as /cdrom
2. add the dvd repo by
% sudp apt-cdrom add
3. enter your password, then insert the dvd repo disk 1 and press enter.
4. do for the other three by repeating step 3 three times.
5. after that, don't forget to update the system using
% sudo apt-get update
Now, you have added dvd repo to your system, next time you wanna install software, you will be asked to insert a specific cd to where the software reside.
Monday, July 2, 2007
transfer big files ....
transferring a file larger than 4 gb was is a pain. i could not do it from fedora 4/5 although ubuntu feisty fawn could.
the problem is I need to transfer file from my gateway server [fedora 5] to file server [fedora 4].
[scp simply cannot do that as the file, ubuntu repo, is over 4gb. it is the limitation of scp protocol.] <-- not sure, see comment!
sftp should be able to do it by don't know why it stops at 4gb marked.
solution using dd:
# dd if=ubuntu-repo-amd64-1.iso | ssh root@192.168.1.1 of=/data/ubuntu-repo-amd64.iso
resulting the same!
any suggestions?
the problem is I need to transfer file from my gateway server [fedora 5] to file server [fedora 4].
[scp simply cannot do that as the file, ubuntu repo, is over 4gb. it is the limitation of scp protocol.] <-- not sure, see comment!
sftp should be able to do it by don't know why it stops at 4gb marked.
solution using dd:
# dd if=ubuntu-repo-amd64-1.iso | ssh root@192.168.1.1 of=/data/ubuntu-repo-amd64.iso
resulting the same!
any suggestions?
Monday, June 18, 2007
livecd ubuntu feisty fawn
I remember that last month, I had a trouble to run the new ubuntu livecd. Unfortunately, the livecd asked for username and password. What were they? I thought using livecd, we did not need to create account first.
Browsing the google, found the solution. Just reburn the cd, it may caused by bad burning process. But, I think it was caused by my cdrw. I used to save the iso in my hd, then burn it to cdrw when needed.
Now, I enjoy my experience with ubuntu....
Browsing the google, found the solution. Just reburn the cd, it may caused by bad burning process. But, I think it was caused by my cdrw. I used to save the iso in my hd, then burn it to cdrw when needed.
Now, I enjoy my experience with ubuntu....
Subscribe to:
Posts (Atom)