Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running Ubuntu, and have installed Apache. When I input my IP address on a web browser, I see the following message:

File browser: main.sh

main.exe is a file which exists in /var/www/ in my computer, and also, the html index.html also exists in the folder:

index.html

<html>
<head>
File Browser
</head>
<body>
<a href = "/main.py">main.sh</a>
</body>
</html>

Now I want to let others download my file in /home/user/anotherfile.sh, except moving anotherfile.sh to /var/www, how can I let others access that file?

If using Apache is inconvenient, any other ideas that implementing it?

share|improve this question

migrated from programmers.stackexchange.com Feb 26 '12 at 10:50

This question came from our site for professional programmers interested in conceptual questions about software development.

add comment

1 Answer 1

up vote 1 down vote accepted

You can create a symlink (short for symbolic link) in the /var/www/ to point to the file in /home/user/anotherfile.sh. The command would be:

cd /var/www/
sudo ln -s /home/user/anotherfile.sh anotherfile.sh

The format of the comand is

ln -s $TARGET $LINK_NAME

The -s option is required to create a symbolic link.

It will create the symlink /var/www/anotherfile.sh that will point to /home/user/anotherfile.sh

You could do that to folders too. That's what I do when I need to share a file.

share|improve this answer
    
thx, its a good idea –  MarkZar Mar 1 '12 at 10:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.