Tag Archives: server

Access to parent folders from user ftp account

Hi,

recently i was needed to set up a ftp account in a test server, so i made it basically adding a user as always. the problem have come when this user, needed to access to a folder located in a higher level than her user directory (basically on /, the root of the system) so, there was only 2 options, or give him  root account and access using scp or having that folder under the home directory in some way. so of course i choose  the second option. my first thing to try was to create a symbolic link from the folder that was needed to access to a one in the user home directory. after several tries, and in different ways, when i tried to access to the folder, alway told me that the file was not found. so searching a little in the proftp documentation i discover that is impossible to access for a user to access to a folder that is in a upper level than her user directory, but that in linux system, you still could “mount” the folder into another. so i made it like this:

mount –bind /folder/upper/level /home/user/directory/for/folder

this will mount the folder on a another in the user home directory and could be accessed from the ftp account. if you want this mount to be permanent, you need to add it to your fstab in this way:

/folder/upper/level     /home/user/directory/for/folder  none rw,bind 0 0

and that’s all folks, i hope this help you in some way :D

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Related Post

Secure your .htaccess password protected directory

Hi,

some days ago also passed another strange stuff in the server, when you tried to access to a password protected directory if you entered the correct password + any other string it let you enter. i was a little clueless about this so i asked on serverFault:

http://serverfault.com/questions/180256/mod-auth-wrong-password-authentication

so as the first answer say’s when you generate a user with the htpasswd command, add the -m or -s (i prefer the -s as is SHA encryption) flag to avoid this problem.

is nice to learn something new every day :)

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Related Post

What to do when a filesystem enter in a read-mode only

Hi,

this happened to me 2 days ago, so i just wanted to share the experience :)

What is this and why it happens?

you are working on your server, and for some reason, when you try to access to your website, the php start to answer in a weird manner, as the sessions are not saved, or do not answer to the post request. then, as a normal server admin, you try to restart the httpd process, and then it fails and tells you that the system is on read-only mode.

i need to say that when this happen, is something really bad, why mean that that there is a corruption of data on the HD and for that the system to prevent more data corruption, lock itself on read-only mode. this usually happen why the HD are corrupted and need to be changed or some wrong operation have corrupted the data on them.

Ok, we are screw up, so now, what we can do?

if you have a active ssh connection, you are lucky, now is the time to backup any (or all) essential files. i suppose that you have a backup of the files, DB and configuration files, but if not, now is the time to do it. i’ll recommend to use a web storage as amazon S3, cheap and reliable in this cases :) . after the backup, is time to face the reality, so umount all the HD and run a fsck. when finish, then reboot. is 90% possible that the server didn’t come back, and you going to need to install and configure everything again.

How i can prevent this?

as far i know you can’t prevent this really, but you can minimize the downtime to minimum implementing a RAID 1 in your servers. in this way, both disks going to have a exact copy, so when one fails, automatically the second one will me mounted. as optional, there are services available to get a email/sms  alerts in this cases (i think also nagios support this type of monitoring). anyway, even that you have a RAID 1, make periodical backups outside your servers, is always a second guaranteed for the data lost and corruption (again, amazon S3 seems to be the best option).

i hope this could help you in some way :D

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Related Post

Apache or ngnix ?

Hi,

some weeks ago someone told me that ngnix was better than apache as can handle more users and was more stable with big traffic. as i usually don’t discard the opinions and recommendations i receive, i started researching about this as i didn’t know anything about ngnix. for that, i wanted to write this post so can save you some time looking at the internet :D . for my research i used sources as serverFault.com and other blog post where it benchmark different php scripts (custom and wordpress blogs).

Apache and ngnix, what is the diference?

the main difference between ngnix and apache is that the way both web servers handle the user requests. apache have a multi thread architecture and ngnix have a unique thread architecture to process the user request. this is the main difference between both, the other important difference are the config files and the rewrite rules, where the format is difference from apache and a new user need to learn this new way to format the htaccess and the config files. other than this, both can manage virtual hosts, aliases,  etc..

Define the goal or purpose to choose.

i always say that there is no a complete tool or a ultimate language and technologies, each decision of what tool to use depends of the requirements of the project. in this case is the same, you need to evaluate your project to decide what to use.

after my research  i found that ngnix have a greater performance, in terms of memory needed, when the ngnix is serving static content. static content is called all what are images, videos, flash, files etc.. and optimized and cached dynamic pages, like a wordpress blog with super cache plugin.

in term of speed both are almost equal, having a difference in favor to ngnix at serving static files.

Conclusion

when i started to research this, i have in mind 2 projects, one of them was a non-optimized sites and the other a highly optimized site that doesn’t have a lot of cached pages but have a lot of static content.

then my conclusion was that you need to choose depending of your project requirement, to use apache or ngnix or both (yes, both can be used at the same time).

if you have a crappy php site, don’t bother you,   ngnix don’t going to give you any improvement, better, invest your time to improve the code.

if you have a highly optimized site and cached most of their pages and you don’t bother to rewrite any htaccess or config file in this new format, ngnix will give you a improvement in your server.

if you have a mixed site, highly optimized, but not too cached her pages, you can have both running, ngnix serving static content and apache serving the dynamic content, this will improve in some way your site with a better load balancing proportional of the percentage of static files are serving.

i hope this help you to decide in this matter, i’ll post later a tutorial of how to install ngnix and apache togheter :)

Regards,

Shadow

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Related Post

Monday Tips #1

Hi,

i going to open and *try* to maintain a new section, called monday tips, where i going to give you some small codes/tips that don’t worth a full post but can save you some ours of work, so  here go:

1)Want to install a DNS? here is a good tutorial that will help you to quickly create a DNS.

2)A good resources of scripts for iptables i found it here

3)Why lawyers don’t run startups a good article about business.

4) copying files using SCP from console is very easy, the syntax of command is:

scp -r -P 22 user@remoteserver:/home/XXX -P 22 user@remoteserver2:/home/XXX

basically there you are copying from server 1 to server 2, if you are logged in a ssh console and want to copy files there, just replace the remoteserver2 with the directory. also, the -P defines the port number, is is 22 as default, is not needed. -r also make it recursive, it going to copy all the contents if a folder is choosed.

and wall for today, i hope you find this information useful :D

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Related Post