Speech talk:Spring 2016 Daisuke Matsukura Log

From Openitware
Jump to: navigation, search

Contents

How to transfer file using SFTP

This all process, you need to connect as a root account when you do change.

It will be denied like,

Couldn't open local file "******" for writing: Permission denied

Basically this steps shows you copy file,

FROM

[root@caesar appsfile]# pwd
/mnt/main/home/sp16/dm1097/appsfile
[root@caesar appsfile]# ls
screen-4.3.1.tar.gz

TO

[root@majestix toolsgroup-screen]# pwd
//tmp/toolsgroup-screen


Preparation

Go to my saved file location "appsfile" where you hope to download file destination

[root@caesar ~]# cd /mnt/main/home/sp16/dm1097/appsfile
[root@caesar dm1097]# ls
appsfile
[root@caesar appsfile]# pwd
/mnt/main/home/sp16/dm1097/appsfile


1. Download file your own created directory on ceaser: type,

wget https://ftp.gnu.org/gnu/screen/screen-4.3.1.tar.gz 

TIP:

Bellow command allows you to download, also, extract an archive under a specified directory.

[dm1097@caesar ~/appsfile]$ wget -qO- https://ftp.gnu.org/gnu/screen/screen-4.3.1  .tar.gz | tar xvz -C /mnt/main/home/sp16/dm1097/appsfile

And after run that command's result is:

[dm1097@caesar ~/appsfile]$ ls
screen-4.3.1  sctk-2.4.10-20151007-1312Z.tar.bz2
[dm1097@caesar ~/appsfile]$ cd screen-4.3.1
[dm1097@caesar screen-4.3.1]$ ls
acconfig.h     configure.ac  layer.h         NEWS.3.6      socket.c
acls.c         COPYING       layout.c        NEWS.3.7      teln.c
acls.h         display.c     layout.h        NEWS.3.9      term.c
ansi.c         display.h     list_display.c  osdef.h.in    termcap.c
ansi.h         doc           list_generic.c  osdef.sh      terminfo
attacher.c     encoding.c    list_generic.h  os.h          term.sh
autogen.sh     etc           list_window.c   patchlevel.h  TODO
braille.c      extern.h      loadav.c        process.c     tty.sh
braille.h      FAQ           logfile.c       pty.c         utf8encodings
braille_tsi.c  fileio.c      logfile.h       putenv.c      utmp.c
canvas.c       HACKING       Makefile.in     README        viewport.c
canvas.h       help.c        mark.c          resize.c      viewport.h
ChangeLog      image.h       mark.h          sched.c       window.c
comm.c         input.c       misc.c          sched.h       window.h
comm.sh        INSTALL       nethack.c       screen.c
config.h.in    install.sh    NEWS            screen.h
configure      layer.c       NEWS.3.5        search.c


Copy steps:

  1. Connect to Majestix
  2. Go to directory, which will be destination of the file location, where you wish to place a specified file.
  3. Connect to Ceasar using "sftp" command from Majestix(destination of the copied file)
  4. Download file using command "get file_name.extention"
  5. Make sure the location you downloaded using ls
  • Type "ssh" to connect Majestix.
[root@caesar appsfile]# ssh majestix
Warning: the RSA host key for 'majestix' differs from the key for the IP address '192.168.10.6'
Offending key for IP in /root/.ssh/known_hosts:6
Matching host key in /root/.ssh/known_hosts:10
Are you sure you want to continue connecting (yes/no)? yes
root@majestix's password:
Connection closed by 192.168.10.6	
  • Login as a root priviledge to Majestix. Then create directory. "toolsgroup-screen" is temporaly destination directory in this case.
[root@majestix tmp]# mkdir toolsgroup-screen
[root@majestix tmp]# ls
keyring-xC2m54      pulse-lV8ncpwCmdHr   yum_save_tx-2016-03-31-20-27YVK_xs.yumtx
orbit-gdm           toolsgroup-screen
pulse-2lcFT96rbpDs  virtual-root.E2LyTy
  • After create, go to the directory, which will be the destination (in this case it use tmp/toolsgroup-screen on Majestix)-----
[root@majestix //]# cd tmp
[root@majestix tmp]# ls
keyring-xC2m54  orbit-root          pulse-lV8ncpwCmdHr  virtual-root.2iP19U
orbit-gdm       pulse-2lcFT96rbpDs  toolsgroup-screen   virtual-root.E2LyTy
[root@majestix tmp]# cd toolsgroup-screen
[root@majestix toolsgroup-screen]# ls

Now it is established connection from Majestix to Ceaser

[root@majestix toolsgroup-screen]# sftp caesar
Connecting to caesar...
root@caesar's password:
  • Go to specific source of the duplication file directory (in this case is under my account directory /dm1097/appsfile)
sftp> cd /mnt/main/home/sp16/dm1097
cd /mnt/main/home/sp16/dm1097
sftp> ls
appsfile
sftp> cd appsfile
sftp> ls
screen-4.3.1                            screen-4.3.1.tar.gz
sctk-2.4.10-20151007-1312Z.tar.bz2

type get "file_name.extention"

sftp> get screen-4.3.1.tar.gz
Fetching /mnt/main/home/sp16/dm1097/appsfile/screen-4.3.1.tar.gz to screen-4.3.1.tar.gz
/mnt/main/home/sp16/dm1097/appsfile/screen-4.3 100%  826KB 826.1KB/s   00:00
sftp> ls
screen-4.3.1                            screen-4.3.1.tar.gz
sctk-2.4.10-20151007-1312Z.tar.bz2
sftp> exit
  • Now check the file on the Majestix directory
[root@majestix toolsgroup-screen]# ls 
screen-4.3.1.tar.gz

Summary: Pasted location is in

copy file using SFTP steps are
  • Source file on Ceasar:
:[root@caesar appsfile]# ls
:screen-4.3.1  screen-4.3.1.tar.gz  sctk-2.4.10-20151007-1312Z.tar.bz2
:[root@caesar appsfile]# pwd
:/mnt/main/home/sp16/dm1097/appsfile
  • Copied over from Ceaser to Majestix using get "file_name.extention"
  • Check destination folder
:[root@majestix toolsgroup-screen]# pwd
://tmp/toolsgroup-screen

Done.

Screen

introduction

Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells. (Screen User's Manual) So, each user can join to same screen and it allows to see same screen over the network. Also it allows collaboration between each users.

Screen allows you to:

  1. Use multiple shell windows from a single SSH session.
  2. Keep a shell active even through network disruptions.
  3. Disconnect and re-connect to a shell sessions from multiple locations.
  4. Run a log running process without maintaining an active shell session.

Jeff Huckaby

Screen Install Documentation

This is a documentation of installation log. During the installation process, Jon of our Tools group was a great help.

Copy File from Ceasar to Majestix

Copy command is:

 tar zcf - screen-4.0.3.tar.gz | ssh root@majestix 'tar zxf -'


[root@caesar screen-rightver]# tar zcf - screen-4.0.3.tar.gz | ssh root@majestix 'tar zxf -'
Warning: the RSA host key for 'majestix' differs from the key for the IP address '192.168.10.6'
Offending key for IP in /root/.ssh/known_hosts:6
Matching host key in /root/.ssh/known_hosts:10
Are you sure you want to continue connecting (yes/no)? yes
root@majestix's password:
[root@caesar screen-rightver]#

Then this is result:

[root@majestix screen-4.0.3]# ls
....
gmp                                screen-4.0.3
gmp-6.1.0-3-i686.pkg.tar.xz        screen-4.0.3.tar.gz
....
[root@majestix screen-4.0.3]# ls
acls.c         COPYING         layer.c      NEWS.3.9      socket.c
acls.h         display.c       layer.h      osdef.h.in    teln.c
ansi.c         display.h       loadav.c     osdef.sh      term.c
ansi.h         doc             logfile.c    os.h          termcap.c
attacher.c     encoding.c      logfile.h    patchlevel.h  term.h.dist
braille.c      etc             Makefile     process.c     terminfo
braille.h      extern.h        Makefile.in  pty.c         term.sh
braille_tsi.c  FAQ             mark.c       putenv.c      TODO
ChangeLog      fileio.c        mark.h       README        tty.c.dist
comm.c         help.c          misc.c       resize.c      tty.sh
comm.h.dist    image.h         nethack.c    sched.c       utf8encodings
comm.sh        input.c         NEWS         sched.h       utmp.c
config.h.in    INSTALL         NEWS.3.5     screen.c      window.c
configure      install.sh      NEWS.3.6     screen.h      window.h
configure.in   kmapdef.c.dist  NEWS.3.7     search.c
[root@majestix screen-4.0.3]#

Create directory for snapshot

Create directory under the /root/snapshot

[root@majestix snapshot]# mkdir before-screen
[root@majestix snapshot]# mkdir after-screen
[root@majestix snapshot]# mkdir diff-screen
[root@majestix snapshot]# ls
after-emacs       after-screen     before-emacsnox23  diff-emacsnox    orig
after-emacsnox    before-emacs     before-screen      diff-emacsnox23
after-emacsnox23  before-emacsnox  diff-emacs         diff-screen


Create .txt snapshot file

Create before installation of snapshot .txt files

[root@majestix snapshot]# ls -al /bin > before-screen/bin.txt
[root@majestix snapshot]# cd before-screen
[root@majestix before-screen]# ls
bin.txt

Repeat same procedure:

[root@majestix before-screen]# ls -al /lib > lib.txt
[root@majestix before-screen]# ls -al /sbin > sbin.txt
[root@majestix before-screen]# ls -al /sys > sys.txt
...
[root@majestix before-screen]# ls
bin.txt  lib.txt  sbin.txt  sys.txt ...


Missing Directory

While creating directories, some directories was not found in Majestix's directory, which professor Jonas mentioned 19 directories.

Exist directories are:

/bin
/lib
/sbin
/sys
/usr/bin
/usr/lib
/usr/sbin
/usr/local
/usr/local/bin
/usr/local/sbin
/usr/local/lib
/usr/share
/usr/libexec
/var/lib/alternatives
/etc/alternatives

Missing directories are:

/sys/bin
/sys/lib
/usr/local

This screen snapshot was created based on Jon Trimble's log on 4/12. Given by Jonas:

1) /bin
2) /lib
2) /sbin
3) /sys
4) /sys/bin
5) /usr/sbin
6) /usr/bin
7) /usr/lib
8) /usr/local
9) /sys/lib
10) /var/lib
11) /var/local
12) /usr/share/lib*

From research by Jon Trimble:

13) /usr/share
14) /usr/local/bin
15) /usr/local/sbin
16) /usr/local/lib
17) /usr/libexec 
18) /var/lib/alternatives ???
19) /etc/alternatives ???

Also, later I noticed that two directory is exist on / and under /root. So, I took / directory snapshot.

Installation of screen

This version of screen-4.0.3 link was provided by Jon Trimble.

http://www.linuxfromscratch.org/blfs/view/6.1/general/screen.html

First Trial

[root@majestix screen-4.0.3]# make install && screen-4.0.3
...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating config.h
config.status: executing default commands
Now please check the pathnames in the Makefile and in the user
configuration section in config.h.
Then type 'make' to make screen. Good luck.
-bash: screen-4.0.3: command not found

Second Trial

Install Screen by running the following commands:

[root@majestix screen-4.0.3]# ./configure --prefix=/usr --with-socket-dir=/var/run/screen \
>     --with-sys-screenrc=/etc/screenrc &&
> sed -i -e "s%/usr/local/etc/screenrc%/etc/screenrc%" {etc,doc}/* &&
> make
this is screen version 4.0.3
checking for gcc... gcc
....
config.status: creating doc/Makefile
config.status: creating config.h
config.status: executing default commands
Now please check the pathnames in the Makefile and in the user
configuration section in config.h.
Then type 'make' to make screen. Good luck.
sed: couldn't edit doc/info: not a r

Then, run bellow command,

[root@majestix screen-4.0.3]# make install && install -m 644 etc/etcscreenrc /etc/screenrc
./etc/mkinstalldirs ./bin `sed < config.h -n -e '/define SCREENENCODINGS/s/^.*"\([^"]*\)"/\1/p'`
...
gcc -c -I. -I.    -g -O2 help.c
gcc -c -I. -I.    -g -O2 termcap.c
gcc -c -I. -I.    -g -O2 input.c
gcc -c -I. -I.    -g -O2 attacher.c
gcc -c -I. -I.    -g -O2 pty.c
pty.c:38:26: error: sys/stropts.h: No such file or directory
make: *** [pty.o] Error 1

Optional dependency, Linux-PAM-0.80 was not able to download. So, it has to find different approach.

Third Trial

5/3 Update: Changed method to install Linux-PAM-0.80 again (followed this documentation). then install screen version 4.0.3 (documentation link)

First install Linux-PAM-0.80

[root@majestix Linux-PAM-0.80]# install -v -d -m755 /usr/share/doc/Linux-PAM-0.80 &&
> for DOCTYPE in html ps specs txts
> do
>     cp -v -R doc/$DOCTYPE /usr/share/doc/Linux-PAM-0.80
> done
install: creating directory `/usr/share/doc/Linux-PAM-0.80'
`doc/html' -> `/usr/share/doc/Linux-PAM-0.80/html'
`doc/html/index.html' -> `/usr/share/doc/Linux-PAM-0.80/html/index.html'
`doc/ps' -> `/usr/share/doc/Linux-PAM-0.80/ps'
`doc/ps/README' -> `/usr/share/doc/Linux-PAM-0.80/ps/README'
`doc/specs' -> `/usr/share/doc/Linux-PAM-0.80/specs'
`doc/specs/rfc86.0.txt' -> `/usr/share/doc/Linux-PAM-0.80/specs/rfc86.0.txt'
`doc/specs/formatter' -> `/usr/share/doc/Linux-PAM-0.80/specs/formatter'
`doc/specs/formatter/parse.lex' -> `/usr/share/doc/Linux-PAM-0.80/specs/formatter/parse.lex'
`doc/specs/formatter/parse.y' -> `/usr/share/doc/Linux-PAM-0.80/specs/formatter/parse.y'
`doc/specs/formatter/Makefile' -> `/usr/share/doc/Linux-PAM-0.80/specs/formatter/Makefile'
`doc/specs/draft-morgan-pam.raw' -> `/usr/share/doc/Linux-PAM-0.80/specs/draft-morgan-pam.raw'
`doc/specs/std-agent-id.raw' -> `/usr/share/doc/Linux-PAM-0.80/specs/std-agent-id.raw'
`doc/txts' -> `/usr/share/doc/Linux-PAM-0.80/txts'
`doc/txts/README' -> `/usr/share/doc/Linux-PAM-0.80/txts/README'

Then install screen

Then install screen-4.0.3,
[root@majestix screen-4.0.3]# make install && install -m 644 etc/etcscreenrc /etc/screenrc
rm -f config.cache
sh ./configure
this is screen version 4.0.3
checking for prefix by checking for screen... no
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
.....
config.status: executing default commands
Now please check the pathnames in the Makefile and in the user
configuration section in config.h.
Then type 'make' to make screen. Good luck.

make install

[root@majestix screen-4.0.3]# make install &&
> install -m 644 etc/etcscreenrc /etc/screenrc
./etc/mkinstalldirs ./bin `sed < config.h -n -e '/define SCREENENCODINGS/s/^.*"\([^"]*\)"/\1/p'`
mkdir ./bin
mkdir ./share
mkdir ./share/screen
mkdir ./share/screen/utf8encodings
cd doc ; make installdirs
make[1]: Entering directory `/root/screen-4.0.3/doc'
./../etc/mkinstalldirs ./man/man1 ./info
mkdir ./man
mkdir ./man/man1
mkdir ./info
make[1]: Leaving directory `/root/screen-4.0.3/doc'
CPP="gcc -E " srcdir=. sh ./osdef.sh
AWK=gawk CC="gcc -g -O2" srcdir=. sh ./comm.sh
AWK=gawk srcdir=. sh ./term.sh
gcc -c -I. -I.    -g -O2 screen.c
gcc -c -I. -I.    -g -O2 ansi.c
gcc -c -I. -I.    -g -O2 fileio.c
gcc -c -I. -I.    -g -O2 mark.c
gcc -c -I. -I.    -g -O2 misc.c
gcc -c -I. -I.    -g -O2 resize.c
gcc -c -I. -I.    -g -O2 socket.c
gcc -c -I. -I.    -g -O2 search.c
sh ./tty.sh tty.c
gcc -c -I. -I.    -g -O2 tty.c
gcc -c -I. -I.    -g -O2 term.c
gcc -c -I. -I.    -g -O2 window.c
gcc -c -I. -I.    -g -O2 utmp.c
gcc -c -I. -I.    -g -O2 loadav.c
gcc -c -I. -I.    -g -O2 putenv.c
gcc -c -I. -I.    -g -O2 help.c
gcc -c -I. -I.    -g -O2 termcap.c
gcc -c -I. -I.    -g -O2 input.c
gcc -c -I. -I.    -g -O2 attacher.c
gcc -c -I. -I.    -g -O2 pty.c
pty.c:38:26: error: sys/stropts.h: No such file or directory
make: *** [pty.o] Error 1
[root@majestix screen-4.0.3]#

Result: still getting error:

pty.c:38:26: error: sys/stropts.h: No such file or directory
make: *** [pty.o] Error 1

Fourth Trial (Succeed Version)

Since I got Tom's suggestion and great help to find installed file location. File seems in the /etc/screenrc. Then remove existing files and directories. Which is already install processed one of screen, which include empty directories. Such as /etc/screenrc FILE and /usr/share/screen FOLDER (empty_)

Then install using rpm this resource with screen version 3.9.15-10 i386(32bit) version

scoped over to server and ran with 'rpm -ivh --test XXX.rpm' So type, for example

rpm -ivh --test rpmFILE.rpm 

It checks for dependency and then run without --test in order to install.

According to Tom's research, reason why this way works, because version of Red Hat Linux is old. It needed install each dependency to much current version.

After Installation

Create each .txt files,

Compare before & after installation files

Compare before installation files and after installation files. Use:

[root@majestix diff-screen]# diff sdiff ../**/**.txt ../**/**.txt > **.txt

Create Soft-link to each servers from Majestix

In order to use other servers such as, Ceasar, Miraculix and so on, just copy screen file to them. So this is the result,

[root@caesar bin]# ls
.....
chk_tree        printtracking  qterm               sphinx3_livepretend
etags           qdisable       screen              sphinx_cont_adseg
.....

And that location is under:

[root@caesar bin]# pwd
/mnt/main/local/bin

But still each dependencies have to be copied file to Hotfix.

Command Tip: Sort from Newest

To show from newest sorted files to oldest.

ls -lt | less

How to use Screen

This is reference, Getting Started Screen

This is multi-user session's explanation

Create Screen Environment (First Person)

If you are first person in order to invite collaboration, you can type

screen


Other joining people

do

screen -ls

This function allows to other people to watch current number of user(s) logged in.

For example, if one user (root) is using on the screen:

[root@majestix ~]# screen -ls
There is a screen on:
        20842.pts-2.majestix    (Attached)
1 Socket in /root/.screen.
If nobody on the screen
[root@majestix ~]# screen -ls
No Sockets found in /root/.screen.

Second people want to join to first person's screen (in this case is root), type,

screeen -x Number

This is actual example,

[root@majestix ~]# screen -x 20842
Screen's Options
If you type screen -h, it shows Screen's Options

More options, see Invoking Screen

About Socket Number
Each person is supposed to be logged in as a individual account so that it shows socket number "** Socket in /root/.screen." which will be changed.

Each Server's Different Setting Note

Majestix does not have any mnt/main/usr connection from Ceaser. So, it does not allows to login as each individual user name. It only allows to connect as root. (5/10/2016 update) As well as Miraculix and Brutus does not allows to use screen on user mode. You will get bellow message,

[username@miraculix ~]$ screen
screen: Command not found.

Rome does not have screen connection as root and users.

NOTE: Other servers' Setting Any user can login as own account on Ceaser, Asterix, Obelix, Idefix