Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
19 views
3 pages
Sshmakefile
Uploaded by
Deepthi Jayanth
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save sshmakefile For Later
Download
Save
Save sshmakefile For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
19 views
3 pages
Sshmakefile
Uploaded by
Deepthi Jayanth
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save sshmakefile For Later
Carousel Previous
Carousel Next
Download
Save
Save sshmakefile For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 3
Search
Fullscreen
2128123, 11:57 AM Remote Compilation Using SSH and Make Issue 21 “Linux Gazette...making Linux just a little more fun!" Remote Compilation Using SSH and Make By John R. Daily,
[email protected]
Problem Occasionally I use my Linux machine at home to write code that I intend to compile on a remote machine, While maintaining open ¢tp and telnet connections to the remote machine to handle the transfer and compilation steps is a manageable solution, T decided to explore ssh and make to develop a more automated method, The benefits of my solution: ‘+ No need to remember which files have been modified. + Ability to use Emacs’ compilation capabilities to move to errors in the source. ‘+ As mentioned above, no need to use ftp and telnet, and hence no benefit to keep an open dialup connection when not compiling, + Automate, automate, automate, Laziness is a virtue. Overview of Solution My first step was to set up ssh and related tools in order to allow secure copying of files to my remote system. While seiting up a .rhosts file is a (barely) acceptable solution, my IP address and name is different each time I dial in, and it ‘would be rather awkward to change the remote system's .rhosts file each time I dialed in. ssh allows me to use a much more secure form of authentication to copy files and execute remote commands. Once I had ssh behaving properly, I used Emacs’ info facility to explore implicit rules in makefiles, and wrote a simple makefile to handle the file transfers and remote compilation. As an example of the intended effect, assume my remote machine is called "remote" (and my local machine "local"), and 've just modified a source file called daenon.c. I would like to execute the following commands in an automated fashion (note that scp is a secure copy command packaged with ssh, and that the -c option specifies compression, useful for dialup connections): scp ~C daemon.c jdaily@renote:~/source-dire: Ssh -C renote "ed source-directory && make’ Implementation First, I needed sshd running on the remote system to handle my secure connections. Fortunately, sshd was already running on the remote system in question, but according to the man pages, it can be run as any user, and is restricted to handling connections for that user (which should be quite sufficient for our needs). Then, I needed to install the ssh toolset on my local machine. Again, ideally these would be installed in a public binary directory such as /usr/ocal/bin, but any user can install them in his/her home directory. {also wanted a key which would allow me to authenticate myself between systems, and which would eliminate the need ‘to type my password each time I tried to run one of the ssh commands. For this, I just ran ssh-keygen, and made sure to not give a pass phrase, so that none would be needed to use my private key to establish the connection. [jdailyBiocal ~}$ ssh-keygen Initializing random number generator... Generating p: sevett (distance 186) Generating q: - : : ce Computing the keys Testing the keys Key generation complete. Enter file in which to save the key (/hone/jdaily/.ssh/identity):
Enter passphrase:
sett (distance 498) hitps:tinuxgazette-netiesue2 Isshmake. html 12128123, 11:57 AM Remote Compilation Using SSH and Make Issue 21 Enter the same passphrase again:
Your identification has been saved in /hone/jdaily/.ssh/identity. Your public key is: 1024 35 718535638573954(. Your public key has beer } Gdaily@local Saved in /hone/Jdaily/.ssh/identity.pub Once I had a public key, | used sep to copy it to the remote machine. [jdailyatocal ~]$ scp -¢ ~/.ssh/identity.pub jdailygrenote:~/.ssh/key jdaily's password:
Then I logged into the remote host and copied the key file into ~/.ssh/authorized_hosts. Ifthat file already existed, T would have appended the key file. Following all this, I could run ssh and scp without needing either a password or a pass phrase to connect to renote, Now I needed a makefile to automate my system. Ideally, the files on the remote machine would be checked to see if they were older than the files on my local machine, and if so, they would be copied over. To simplify matters, I decided to keep a record of the "last transferred date" for each file by touching a corresponding file each time I copied a source file over. As an example, when I transferred a newer copy of daenon.c over, [ touched daemon. ct in the same directory. Any transfer ofa .h file would be marked by the creation of a file with a .ht suffix. ‘After poking around the info file for make, [ came up with the following makefile. REXEC=ssh SSHFLAGS=-C # Compress data REVOTE=daily@renote:~/source-directory FILES=dabug.ht messages.nt client.ct daenon.ct queue.ct queve.ht Sant tah S(TRANSFER) $(SSHFLAGS) $< $(REWOTE) touch $8 Bact 1 he S(TRANSEER) $(SSHFLAGS) $< $(RENOTE) touch $8 all-done: $(FILES) S(REXEC) $(SSHFLAGS) remote “cd source-cirectory 8& make" touch all-dene This had one limitation in particular; I was unable to specify command-line arguments for make on the remote machine without writing them directly into the makefile on my local system. While this was fine for the current application, I decided to generalize it by creating a run-rake shell script, which would handle the remote execution of make after calling make on the local system. Here is my run-make shell seript: s1/bin/sh make echo ssh -C renote \"cd source-directory \8\& make $*\" ssh -C renote "ed source-directory && make $*" I then removed the line from my makefile which remotely ran make. Here's the output from a successful compilation sequence. cd ~/source-directory/ -/run-nake scp ~C debug.h jdaily@renote:~/source-directory touch debug-ht scp ~C messages.h jdaily@renote:~/source-directory touch messages.ht scp ~C client.c jdailyfrenote:~/source-directory touch client.ct scp ~C daemon.c jdailyfrenote:~/source-directory touch daenon.ct scp ~C queve.c jdaily@renote:~/source-directory hitps:tinuxgazette-netiesue2 Isshmake. html 282128123, 11:57 AM Remote Compilation Using SSH and Make Issue 21 touch queve.ct scp -C queve.h jdaily@renote:~/source-directory touch queue.ht ‘touch al-done ssh -C renote “cd source-directory 88 make Bcc -Wall -Wstrict- prototypes -Wmissing-prototypes -g -c queve.c Bcc -Wall -Wstrict-prototypes -Wnissing-prototypes -B -DPORT=3008 -o daenon daenon.c queue.o ~lsocket -Ithread gcc -Well -Wstrict- prototypes -hmissing-prototypes -g -DPORT=3020 -o client client.c -Isocket Compilation finished at Sat Aug 9 @1:22:19 Tools ssi is a secure replacement for such tools as rsh, rlogin, and rcp. It can be found at http://www.es.hut.fi/ssh. nnake is a standard Unix utility. GNU’s make comes with most, if not all, Linux distributions. Copyright © 1997, John R. Daily Published in Issue 21 ofthe Linux Gazette, September 1997 [Meee [ee] SI hitps:tinuxgazette-netiesue2 Isshmake. html 38
You might also like
All UNIX COMMANDS
PDF
100% (4)
All UNIX COMMANDS
658 pages
Identifying Remote Users: SSH User02@remotehost
PDF
No ratings yet
Identifying Remote Users: SSH User02@remotehost
4 pages
Package SSH': R Topics Documented
PDF
No ratings yet
Package SSH': R Topics Documented
6 pages
SSH Presentation
PDF
No ratings yet
SSH Presentation
11 pages
SSH
PDF
No ratings yet
SSH
2 pages
ssh(secure-shell)
PDF
No ratings yet
ssh(secure-shell)
9 pages
SSH and SCP: Howto, Tips & Tricks: RSS Feeds
PDF
No ratings yet
SSH and SCP: Howto, Tips & Tricks: RSS Feeds
7 pages
Linux Remote Access & Administration
PDF
No ratings yet
Linux Remote Access & Administration
10 pages
7 Things Every System Administrator Should Know About Openssh
PDF
No ratings yet
7 Things Every System Administrator Should Know About Openssh
7 pages
Lecture 4
PDF
No ratings yet
Lecture 4
26 pages
SSH Keys
PDF
No ratings yet
SSH Keys
2 pages
SSH, The Secure Shell
PDF
No ratings yet
SSH, The Secure Shell
9 pages
Section4_Jenkins & Docker
PDF
No ratings yet
Section4_Jenkins & Docker
6 pages
SSH Cheat Sheet
PDF
No ratings yet
SSH Cheat Sheet
2 pages
Linux B Essential 3.5-4
PDF
No ratings yet
Linux B Essential 3.5-4
63 pages
How To Generate SSH Key With ssh-keygen In Linux
PDF
No ratings yet
How To Generate SSH Key With ssh-keygen In Linux
5 pages
An Overview of SSH: Presentation To Linux Users of Victoria
PDF
No ratings yet
An Overview of SSH: Presentation To Linux Users of Victoria
16 pages
The Keys To Using SSH: David Tomaschik
PDF
No ratings yet
The Keys To Using SSH: David Tomaschik
41 pages
15 SSH, SCP - Secure Shell, Secure
PDF
No ratings yet
15 SSH, SCP - Secure Shell, Secure
16 pages
Advanced OpenSSH PDF
PDF
No ratings yet
Advanced OpenSSH PDF
2 pages
SSH 4.9.1.4 May 3, 2022
PDF
No ratings yet
SSH 4.9.1.4 May 3, 2022
79 pages
Jenkins Execute Script Over SSH
PDF
No ratings yet
Jenkins Execute Script Over SSH
3 pages
Manual
PDF
No ratings yet
Manual
11 pages
SSH Tutorial
PDF
100% (1)
SSH Tutorial
16 pages
Private Public Key Setup
PDF
No ratings yet
Private Public Key Setup
4 pages
Linux_Server_Management-4
PDF
No ratings yet
Linux_Server_Management-4
30 pages
SSHD Server and The SSH Client
PDF
No ratings yet
SSHD Server and The SSH Client
12 pages
SSH 5.1.2 February 8, 2024
PDF
No ratings yet
SSH 5.1.2 February 8, 2024
97 pages
SSH Tips and Tricks: Ferry Boender May 2, 2011 (Last Updated Jan 29, 2019)
PDF
No ratings yet
SSH Tips and Tricks: Ferry Boender May 2, 2011 (Last Updated Jan 29, 2019)
14 pages
Answers on Linux Lecture 5
PDF
No ratings yet
Answers on Linux Lecture 5
2 pages
Threadsafe Man: Command Description
PDF
No ratings yet
Threadsafe Man: Command Description
8 pages
Cut & Paste More Linux Commands: Command Description
PDF
No ratings yet
Cut & Paste More Linux Commands: Command Description
30 pages
Threadsafe Man: Command Description
PDF
No ratings yet
Threadsafe Man: Command Description
14 pages
A Brief History of SSH and Remote Access
PDF
No ratings yet
A Brief History of SSH and Remote Access
5 pages
Configure SSH For RAC Environment
PDF
No ratings yet
Configure SSH For RAC Environment
6 pages
CyberAces Module3-Bash 5 PracticalUses
PDF
No ratings yet
CyberAces Module3-Bash 5 PracticalUses
16 pages
SSH
PDF
No ratings yet
SSH
18 pages
SCP
PDF
No ratings yet
SCP
4 pages
Setup and Configuration For OpenSSH
PDF
No ratings yet
Setup and Configuration For OpenSSH
13 pages
Command Unix
PDF
No ratings yet
Command Unix
4 pages
En Crept Yed Book
PDF
No ratings yet
En Crept Yed Book
1 page
ssh-agent
PDF
No ratings yet
ssh-agent
3 pages
Linux Lab 17 Secure Teleworking SSH and Keys
PDF
No ratings yet
Linux Lab 17 Secure Teleworking SSH and Keys
1 page
PSSH HOWTO PDF
PDF
No ratings yet
PSSH HOWTO PDF
5 pages
Putty
PDF
No ratings yet
Putty
146 pages
SSH Cheat Sheet
PDF
No ratings yet
SSH Cheat Sheet
4 pages
Breaking Firewalls With Openssh and Putty
PDF
No ratings yet
Breaking Firewalls With Openssh and Putty
12 pages
09 Authentication
PDF
No ratings yet
09 Authentication
15 pages
Experiment No. 04: To Analysis The Secure Connection Establishment Through SSH and Telnet On
PDF
No ratings yet
Experiment No. 04: To Analysis The Secure Connection Establishment Through SSH and Telnet On
7 pages
4.1.2 SSH
PDF
No ratings yet
4.1.2 SSH
8 pages
Linux Commands - A Practical Reference
PDF
No ratings yet
Linux Commands - A Practical Reference
8 pages
Linux Commands
PDF
No ratings yet
Linux Commands
36 pages
If You Get An Empty Page
PDF
No ratings yet
If You Get An Empty Page
14 pages
How to Connect to a Remote Server via SSH from Windows
PDF
No ratings yet
How to Connect to a Remote Server via SSH from Windows
12 pages