Default ssh username for AMI – AWS EC2 Instances

Amazon EC2

Amazon EC2

Just for my quick reference:

  • For an Amazon Linux AMI, the user name is ec2-user.
  • For a Centos AMI, the user name is centos.
  • For a Debian AMI, the user name is admin or root.
  • For a Fedora AMI, the user name is ec2-user or fedora.
  • For a RHEL AMI, the user name is ec2-user or root.
  • For a SUSE AMI, the user name is ec2-user or root.
  • For an Ubuntu AMI, the user name is ubuntu or root.
  • Otherwise, if ec2-user and root don’t work, check with the AMI provider.

Reference AWS Guide: 

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html#ssh-prereqs

How to install and configure sudo in Solaris Sparc 10

Sudo Vision

Sudo Vision

First you need following packages to install

gcc-3.4.6-sol10-sparc-local.gz
libiconv-1.13.1-sol10-sparc-local.gz
libintl-3.4.0-sol10-sparc-local.gz
sudo-1.7.2p5-sol10-sparc-local.gz

Install with following command

pkgadd -d downloadPath/filename

If you are unable to find sudo package online, your Solaris Sparc Companion disk contains it

Directory in Solaric Sparc Companion disk which contain sudo is “SFWsudo”

If I assume your path to package is /cdrom/Solaris_sparc/sparc/components/SFWsudo

Install by following command

pkgadd –d /cdrom/Solaris_sparc/sparc/components/  SFWsudo

After your installation is complete

First find the path of binary and configuration files, following is my example:

grep sudoers /var/sadm/install/contents

/opt/sfw/etc/sudoers f none 0440 root root 589 50133 1104945433 SFWsudo
/opt/sfw/man/man4/sudoers.4 f none 0444 root bin 57547 31697 1104945433 SFWsudo
/usr/local/share/vim/vim73/ftplugin/sudoers.vim f none 0644 bin bin 426 36373 1285497623 SMCvim
/usr/local/share/vim/vim73/syntax/sudoers.vim f none 0644 bin bin 19276 64681 1285497623 SMCvim 

Now my I can see that my configuration file i.e. sudoers is in /opt/sfw/etc/sudoers and for sudo it is always in the same path but in /bin directory i.e. /opt/sfw/bin/sudo

Steps for sudo to work properly:

  1. Add /opt/sfw/bin  in your PATH if it is not available – check with echo $PATH
  2. Sudoers file default permission will be read only, for making changes you will need to first change the permission of sudoers file and edit your changes and revert back the permission of sudoers file to (chmod 440)
  3. Sudo binary which is in /opt/sfw/bin should have the sticky bit set permission i.e. (chmod u+s )

And you are done here, enjoy and start using sudo

HowTo configure Telnet on Linux (Redhat)

Telnet

Telnet

Re-blogged from Zahidhaseeb’s Blog:

In my environment I have used Linux Redhat 6.2

  • Install three packages telnet-server, telnet and xinetd.
  • Make sure that the xinetd service should be running.
  • Configure the file name /etc/xinetd/telnet

1.) Install three packages telnet-server, telnet and xinetd.

You need to install three services

for example # yum install telnet-server telnet
the above command will also install the xinetd service. See the following example for reference:

Dependencies Resolved

=====================================================
Package               Arch         Version                  Repository    Size
=====================================================
Installing:
telnet                i686         1:0.17-47.el6            base          56 k
telnet-server         i686         1:0.17-47.el6            base          36 k
Installing for dependencies:
xinetd                i686         2:2.3.14-33.el6          base         121 k

Transaction Summary
=====================================================
Install       3 Package(s)

Total download size: 213 k
Installed size: 409 k

2.) Make sure that the xinetd service should be running.

# service xinetd status
xinetd (pid  13561) is running…

Please also note: Make sure that your firewall also stopped or the telnet traffic is allowed

3.) Configure the file name /etc/xinetd.d/telnet

We need to change the following highlighted line from yes to no

# vi /etc/xinetd.d/telnet
# default: on
# description: The telnet server serves telnet sessions; it uses \
#    unencrypted username/password pairs for authentication.
service telnet
{
flags        = REUSE
socket_type    = stream
wait        = no
user        = root
server        = /usr/sbin/in.telnetd
log_on_failure    += USERID
disable        = yes
}

Note:

In few scenarios, telnet works over the ip, but does not resolve specific ports. In that case xinetd services needs a restart

“service xinetd restart”

Convert RHN repositories (yum) with RHEL Media DVD repository

yum

repositories (yum)

Re-blogged from Zahidhaseeb’s Blog:

Step # 1

# pwd
/etc/yum.repos.d

Step # 2

# vi rhel-source.repo

Step # 3
You may see a result like below

[rhel-source]
name=Red Hat Enterprise Linux $releasever – $basearch – Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-source-beta]
name=Red Hat Enterprise Linux $releasever Beta – $basearch – Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Step # 4

Add the below lines on the top of file above

[Media]
name=RHELmedia
baseurl=file:///media/RHEL_6.2\ x86_64\ Disc\ 1/Server/
enabled=1
gpgcheck=0

Please Note: Keep enabled=1 for [Media] and mark enabled=0 for[rhel-source-beta] and [rhel-source] .

Conclusion

Now you will be able to use yum command and the request will redirect to the DVD media of Redhat which you inserted in the CD/DVDrom (instead of going to internet/RHN)

Helpful Link

http://blog.sriunplugged.com/linux/adding-redhat-dvd-as-repository/

LVM / Logical Volume Manager

LVM / Logical Volume Manager

LVM / Logical Volume Manager

It can be said as a thin software layer on top of the hard drives and partitions, which creates illusion of continuity and easy of use for managing hard drives replacement, re-partitioning and backups.

It’s common usages are to manage large drives farm by adding a disk, replacing a disk, copy and share the disks without interrupting services running. For small setups there is no need to worry about partition size offering for requirements in future as disks partition can be re-sized easily on run-time, further making backups by taking snapshots and creating single logical volume of multiple physical volumes or entire hard disks functionality is also available.

Features of LVM

  • Re-size volume groups
  • Re-size logical volumes
  • Create read-only snapshot – LVM1
  • Create read-write snapshot – LVM2
  • Strips whole or parts of logical volumes (similar Raid0)
  • Mirror whole or parts of logical volumes (similar Raid1)
  • Move online logical volumes
  • Split or merge volume groups

Almost features can be performed online without disrupting users.

Some Linux Definition

Linux

Linux

Some basic definition which I wanted to remember always, in my early stages, whereas which is very important to understand if someone will like to learn Unix / Linux with basic concepts rather then just a knowing.

  1. Kernel – It is the core of the system. It controls all the tasks, schedules all the process and carries out all the functions of the operating system. It is the code that controls the interface between user programs and hardware devices. Please always remember it is not an operating system.
  2. Shell – It is the command interpreter of the operating system. It accepts commands from the user and analyzes and interprets these commands. Hence shell acts as a middle man between the Kernel and the users of operating system.
  3. Command – It is a instruction given by a user telling a computer to do something, such as to run a program.
  4. Program – It is an executable file usually files that are stored in one of the bin directory.

Have figured out these definitions from numerous areas.  Share more if you feel like to include in the list.

PATH in Linux

Path

Path via Clearly Creative

Path is an important area to understand when it comes to Unix / Linux.

What is PATH ?

It is an enviornmental variable in Unix / Linux that tells the shell which directories to search for executable files in response to commands issued by the user. Enviornmental variables are items for which values can be changed.

There are two types of PATH

1. Absolute Path

An abosolute path is easily recognized from the leading forward slash “/”. You start at the top level directory and continue down.

for e.g cd /boot/grub

2. Relative Path

A relative path doesn’t have a preceeding slash, usage of relative path is when you start from directory below the top level. This is dependent on where you are in the filesystem.

for e.g. While being in user’s home directory, going to /user/music you just type cd music

Note. My words are covered with my research therefore some might contain to some reference.

File Types & I/O Rediction

I/O

I/O

I was has having problem in recognizing file types in my studies, therefore to learn I searched and read few documents and found these types under Unix / Linux:-

  • (-) – ASCII/ordinary files
  • (d) – Directories
  • (c) – Character Special Files
  • (b) – Block Special Files
  • (p) – FIFO Files or Pipes

Further everything which carry down with Input Output Redirection over entire Unix / Linux is followed by

  • Standard Input – “0” – Keyboard
  • Standard Output – “1” – Terminal / Display
  • Standard Error – “2” – Terminal / Display

Note:- It will be pleasure if someone would like to contribute more to this post

Some History Points of Unix / Linux

LINUX LINUS TORVALDS

LINUX LINUS TORVALDS

As I entered in the world of open-source by adopting Unix / Linux on my passion list, few basic things which I highlighted in the beginning were written down on a piece of paper. Thought to pool it down for my memories.

Unix / Linux

  • Minix – Unix like operating system before Linux
  • Unix – developed by Bill Labs
  • BSD – Popular distribution from University of California at Barkley
  • Main Purpose – Multitasking system for minicomputers
  • Linux originally developed by Linux Torvalds, began work in 1991 as a student in Finland at University of Helsinki
  • Linux Kernel – Lowest level core component is still maintained by Linus Torvalds
  • March 1994 – Version 1.0 finally was appeared.
  • Text Formatter (TeX) was by Donald Knutn
  • Linux is an inexpensive, efficient and robust system.

Hope you have got the vision of how basically we all started, like I have done. Share your experience for more fun.