Gazolinia - Life of Software Engineer
Creators of future world....
Showing posts with label Amatuer world of Unix/Linux. Show all posts
Showing posts with label Amatuer world of Unix/Linux. Show all posts

For the last one year it was maximum of 20 commands I should have issued in linux boxes and most of the time might have ended with PERMISSION DENIED error. But its been last one month or so, I had some good time with linux. To be frank first I felt little tough, but when it started moving it was awesome. Even though I cannot tell myself as a perfect linux administrator, I am a good linux user. This all started on a day when I just got sudo permission in one of the dev box.There I started installing Perl, PHP ,APache etc. Eventhough most of the time it is just YUM , I got little in my pocket .

The real stuff started when I was asked to install Grsecurity and sbox in the machine . To do Grsecurity it asked me to compile a kernel with Grsecurity patch. First I felt like this things need to be done by great geeks , but finally after following the steps given in LINUX NUT SHELL I too did it. Then loaded grsecurity patched kernel, and tested few of our application. But finally my search came to end only after writing LKM (Loadable Kernel Modules) for over writing few system calls . This is the place where I felt the real flavor of linux .

My dream on this linux world still continues. Once I complete my project I guess I can say myself as linux administrator. Passionately waiting for that day .

Bookmark and Share

 

To be frank even though my host is Windows , my work normally happens in solaris/Linux boxes. For this I use Exceed as my remote login tool.

It was during while setting up the boxes I went through the SSh stuffs. After then even though I type daily atleast 10 times ssh command, I forgot the steps what happens internally .Its reallly bad right.So just thought of going through the basics of it and got landed at right place.

The basic steps are as follows:

1: Public and Private keys exist on the SSH server.(let's say 10.10.0.1) They were generated by the server Admin at the time SSH was first set up.

2: A user (10.10.0.30) attempts to ssh into the server (10.10.0.1). The server sends its PUBLIC KEY to the user.

3: The user checks to see if the PUBLIC KEY exists already in its system. If not, the user is warned that this key is not in the system. Once the user accepts the key, it is added to the trusted list.

4: The user (10.10.0.30) uses the server's PUBLIC KEY to encrypt all communications to the server (10.10.0.1). At the initial stage, this would include user name, password.

5: The user (10.10.0.30) also sends it's PUBLIC KEY to the server. (This is NOT the same as the Server's PUBLIC KEY). This is generated newly per every new SSH session(??)

6: The server uses it's own PRIVATE KEY to decrypt all communications from the user. (Which the user encrypted using the server's PUBLIC KEY) The server then uses the user's PUBLIC KEY to encrypt all communications before sending them on to the user.

7: The user then uses it's PRIVATE KEY to decrypt all communications send by the server. (Which the server encrypted using the user's PUBLIC KEY)

8: No one other than the server can decrypt packets encrypted with the server's PUBLIC KEY (Because only the server knows its own PRIVATE KEY).

9: No one other than the client can decrypt packets encrypted with the client's PUBLIC KEY (Because only the client knows its own PRIVATE KEY)

10: Points 8 & 9 work because the PUBLIC and PRIVATE keys are both huge primary numbers that are mathematically related, but would require an unimaginable number of calculations/computing power to derive one from the other.


In reference to: [other] How does SSH Work? - Ubuntu Forums (view on Google Sidewiki)
Bookmark and Share

 

Steps to setup remote repository in remote_repo_server.com

1) ssh to 'remote_repo_server.com'
2) cd /home/username/git_remote/
3) mkdir remote_repository1.git
4) cd remote_repository1.git
5) git --bare init

Steps to setup local repo and link to above remote repository

1) ssh to local_repo_server.com
2) cd /home/username/git_local
3) mkdir local_repository1
4) cd local_repository1
5) git init
6) touch README
7) git add README
8) git commit -m 'first commit'
9) git remote add my_remote_repo_server ssh://remote_repo_server.com/home/username/git_remote/remote_repository.git
10) git push my_remote_repo_server master

This is my finalized steps which I got from link

Bookmark and Share

 

After I successfully Installed the GIT in my local user . I need to setup the remote repository in server end. When I am googling this I got this page which proves my work is done most. Setting up GIT remote server is as easy as creating the user in Unix.

They say its only 4 steps.

1) Install GIT what I did previously
2) Create one user git in your box.

sudo adduser git

3) Then Create the repository .

# login to remote server
ssh git@REMOTE_SERVER
# once logged in
mkdir example.git
cd example.git
git --bare init

4) Commit to this new repository .

mkdir example
cd example
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@REMOTE_SERVER:example.git
git push origin master

With the above doc help I worked out in my local box and added few more steps .
To know more on this please see my sidewiki link.

in reference to:

"mkdir example cd example git init touch README git add README git commit -m 'first commit' git remote add origin git@REMOTE_SERVER:example.git git push origin master"
- CommonThread Blog Setting Up a Git Server (view on Google Sidewiki)

Bookmark and Share

 

The Internet says the answer is GIT, so for the past few days I have been trying to learn something about GIT( but still Iam a CVS user).

Git is a free distributed revision control, or software source code management project with an emphasis on being fast. Git was initially designed and developed by Linus Torvalds for Linux kernel development.

Why the name GIT ?
Linus Torvalds has quipped about the name "git", which is British English slang for a stupid or unpleasant person. "I'm an egotistical bastard, and I name all my projects after myself. First Linux, now git." This self-deprecating humor is tongue-in-cheek, as Torvalds was actually pressured into naming Linux after himself .

I guess its enough of wikipedia's history let me share my little knowledge on GIT to you people. Before installing the server as your own, try this GITHUB social coding site . First create a free repository here, then install the GIT client in your end (I installed this in solaris, not a big deal just gzip -d , untar and make install ) . Just for the try I commited few files and checked it. Its really coooolllll.

Now my next step is to install the GIT server in my local box . I am not sure whether it will be easy or not ? After then its migration from CVS to GIT if possible. Let see how this project goes for me................

in reference to: jkamaraj's Gazolinia at master - GitHub (view on Google Sidewiki)
Bookmark and Share

 

























My working environment is something Interesting and funny , logging into remote servers ,digigng inside web logs , source codes etc . Nobody in our team of 3 , clearly knows how many modules we have in our application ,why that server running ? why that db breaks ? .To add this we have code of 1000 files each consisting around 1000 lines, without even a line of documentation . Eventhough it looks tough , it is really interesting to look at the code written by some great coders and understanding .

So whenever a new issue comes ,we start digging the code . Will go to the source code root directory and execute the command grep -r -i "keyword" ~/free ,which will return some 100's of files containing that particular key word , if that fails need to go for egrep, fgrep , pipe etc . From the result of around 100 files we need to get to the core function where exactly the error comes . Without this grep function I can't even imagine my work .

Some times we will be provided with a file name causing the error ,but not the path .So there comes this command find path -iname "filename" . Yes this will search for a file with the name mentioned in filename part in the directory mentioned in path in a recursive way and give the list .

Yes from the set of commands I use . This two commands ranks top . To say better they are like a God showing the path to me
Bookmark and Share

 

The Unix Hierarchy of
Being



NAME DESCRIPTION AND
FEATURES
Beginner

  • insecure with the concept of a terminal
  • has yet to learn the basics of vi
  • has not figured out how to get a directory
  • still has trouble with typing <Return> after each line of
    input
Novice

  • knows that "ls" will produce a directory
  • uses the editor, but calls it "vye"
  • has heard of "C" but never used it
  • has had a bad experience with rm
  • is wondering how to read mail
  • is wondering why the person next door seems to like Unix so very
    much
User

  • uses vi and nroff, but inexpertly
  • has heard of regular expressions but never seen one
  • has figured out that "-" precedes options
  • has attempted to write a C program, but decided to stick with Pascal

  • is wondering how to move a directory
  • thinks that dbx is a brand of stereo component
  • knows how to read mail and is wondering how to read
    news
Knowledgeable
User


  • uses nroff with no trouble, and is beginning to learn tbl and eqn
  • uses grep to search for fixed strings
  • has figured out that mv(1) will move directories
  • has learned that "learn" doesn't help
  • somebody has shown him how to write C programs
  • once used sed but checked the file afterwards
  • watched somebody use dbx once
  • tried "make" but used spaces instead of tabs
Expert

  • uses sed when necessary
  • uses macros in vi, uses ex when necessary
  • posts news at every possible opportunity
  • is still wondering how to successfully reply to mail
  • writes csh scripts occasionally
  • writes C programs using vi and compiles with make
  • has figured out what && and | | are for
  • uses fgrep because somebody said it was faster
Hacker

  • uses sed and awk with comfort
  • uses undocumented features of vi
  • writes C code with "cat >" and compiles with "!cc"
  • uses adb because he doesn't trust source debuggers
  • figured out how environment variables are propagated
  • writes his own nroff macros to supplement the standard ones
  • writes Bourne shell scripts
  • installs bug fixes from the net
  • uses egrep because he timed it
Guru

  • uses m4 and lex with comfort
  • writes assembler code with "cat >"
  • uses adb on the kernel while the system is loaded
  • customizes Unix utilities by patching the source
  • reads device driver source with breakfast
  • uses "ed" because "ex" is a Berkeleyism
  • can answer any Unix question after a little thought
  • uses make for anything that requires two or more commands
  • has learned how to breach security but no longer needs to try
  • is putting James Woods/Henry Spencer egrep into his next Unix
    release
Wizard

  • writes device drivers with "cat >"
  • fixes bugs by patching the binaries
  • posts his changes to Unix utilities to the net, and they work
  • can tell what question you are about to ask, and answers it
  • writes his own troff macro packages
  • is on a first-name basis with Dennis, Bill, and
    Ken

This is one of the mail , I got from my friend and identified myself as proud Knowledgeable
User .But you may ask why the post label is "Amatuer world of Unix" ?.
Bookmark and Share

 

Yes this command is really simple .What this command actually do is ? It just copy from a server to server using ssh protocol.

Example:

You are logged into a server a.com in command mode and want to copy a file from secure server b.com to a.com. You can use this command provided you have the permission to access the server b.com securely.

>>>>>>>>>hostname
a.com
>>>>>>>>>scp b.com:filepath .

Thats it you will have the file now in your pwd of a.com.

Bookmark and Share

 


Just fun guys . Don't be serious ... Its all part of this fun filled world , to tease even the bests .

Bookmark and Share

 

These editors may seem to be out dated ,but even now many companies use this editors . So its better to know some of the basic commands used there.

General Startup
To use vi: vi filename
To exit vi and save changes: ZZ or :wq
To exit vi without saving changes: :q!
To enter vi command mode: [esc] Counts
A number preceding any vi command tells vi to repeat that command that many times.

Cursor Movement
h move left (backspace)
j move down
k move up
l move right (spacebar)
[return] move to the beginning of the next line
$ last column on the current line
0 move cursor to the first column on the current line
H move cursor to the top of the screen
M move cursor to the middle of the screen
L move cursor to the bottom of the screen

Inserting
r replace character under cursor with next character typed
R keep replacing character until [esc] is hit
i insert before cursor
a append after cursor
A append at end of line
O open line above cursor and enter append mode

Deleting
x delete character under cursor
dd delete line under cursor
dw delete word under cursor
db delete word before cursor

Copying
Code yy (yank)'copies' line which may then be put by the p(put) command. Precede with a count for multiple lines.

Put
Command brings back previous deletion or yank of lines, words, or characters
P bring back before cursor
p bring back after cursor

Find Commands
? finds a word going backwards
/ finds a word going forwards

Miscellaneous Commands
. repeat last command u undoes last command issued
U undoes all commands on one line

Line Editor Mode
Any commands form the line editor ex can be issued upon entering line mode.
To enter: type ':' To exit: press[return] or [esc]

Bookmark and Share