Solved

compiling programs

Posted on 1998-10-24
5
206 Views
Last Modified: 2010-04-20
how can I compile/run script that look LIKE
echo "Blah Blah. "
mv /home/users/ciris /home/ciris
rm /home/users/ciris/file
echo "finished."
?
0
Comment
Question by:ciris
  • 3
  • 2
5 Comments
 
LVL 19

Expert Comment

by:xterm
Comment Utility
Compile it?   You don't need to compile anything - your
script is ready to go.  Just put the line "#!/bin/sh" at
the top of a new file, enter your 4 lines below that, and
save it.

Then "chmod u+x filename" and run it with "./filename"
(or you can type "sh filename")
0
 

Author Comment

by:ciris
Comment Utility
if I name it blah, how can I get it to be executed (in that directory only) as blah, not ./blah?
0
 
LVL 19

Accepted Solution

by:
xterm earned 100 total points
Comment Utility
Well, you could add "." to your path by doing:
export PATH=$PATH:.

.but it is recommended generally that you do not login
as root with "." in your path (although the risk of being
trojaned with that being the last item in your path is
minimal).

An example would be if a user put a file called "ls" in his
home directory that contained "rm /etc/passwd" - you get the
idea, I'm sure.
0
 

Author Comment

by:ciris
Comment Utility
deleting the password file would delete the passwords, right? would this work with a shadowed password?
0
 
LVL 19

Expert Comment

by:xterm
Comment Utility
No, you'd have to delete /etc/shadow too - that wasn't my
point.  My point was that horrible things can happen if an
unsuspecting admin had . in their path & they had some
malicious shell users.  
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now