Browsing articles tagged with "files - Admins Goodies"
Jan 6, 2013
tom

SSH: connect with public key avoiding passphrase prompt

root@myhost:/# ssh -i /opt/id_rsa.pub azureuser@myhost2.cloudapp.net Enter passphrase for key ‘/opt/id_rsa.pub': azureuser@myhost2.cloudapp.net’s password: I have created key pair without passphrase, is it possible to get rid of passphrase prompt while connecting to remote server? I would like to use key connection while using this command: tar -c /opt/lampp/htdocs/somehost | ssh -i /opt/id_rsa.pub azureuser@myhost2.cloudapp.net ‘tar -xvf – -C /opt/somefolder’ > /dev/null 2>&1 & So that files transfer continue even if terminal have lost connection. Asked by Somebody […]

Continue Reading »
Dec 31, 2012
tom

Get total files size from a file containing a file list

I have a file containing a list of files that I would like to know the total files size. Is there a command to do so? My OS is a very basic linux (Qnap TS-410). EDIT: A few lines from the file: /share/archive/Bailey Test/BD006/0.tga /share/archive/Bailey/BD007/1 version 1.tga /share/archive/Bailey 2/BD007/example.tga Asked by Nicolas I believe something like this would work in busybox: du `cat filelist.txt` | awk ‘{i+=$1} END {print i}’ I don’t have the same […]

Continue Reading »
Oct 1, 2012
tom

Force Close a file not a process

I want to write a script that forces closed a specific file and then copies it from one server to another. To manually do this I would use Administrative Tools –> Computer Management –> Shared Folders –> Open Files Is there a way to script this? Asked by Funky Si I’ve used the SysInternals utility Handle in the past and wrapped a script around that before. You could also use the command: net file /close […]

Continue Reading »
May 21, 2012
tom

How do I hide a directory of text files on IIS?

I have a directory of text files on IIS. I would like this directory to be hidden. I have set the web.config as follow: <?xml version=”1.0″ encoding=”utf-8″ ?> <configuration> <system.web> <authorization> <deny users=”*” /> <!– Denies all users –> </authorization> </system.web> </configuration> But I can still see a full directory listing of the files, as well as access the files over the web. What am i setting wrong? I have tried this too: <system.webServer> <security> […]

Continue Reading »
May 9, 2012
tom

Recursive deletion of files (bash)

I’m familiar with how I would tackle this with PHP, however I’d like to get some more practice with bash scripting. The task is to delete all files in a folder, which itself contains subfolders (with files). The files would typically be .pdf (or some variant: PDF, Pdf, pDf, ect), however there may occasionally be other file types including extensions unknown to me at this time. Here’s what I have so far. It echoes the […]

Continue Reading »
Apr 12, 2012
tom

How to make a PHP file unavailable to users?

I have a file queue.php which I have set up as a cron job. I don’t want users to be able to access it. How can I do this? Asked by Jonathan Lingle Straight file permissions should do the trick. Just make the file readable by the user that cron runs as and not by anyone else. chmod [restricted-user]:[restricted-group] 640 should do it. Answered by WesleyDavid Check more discussion of this question. Bookmark on Delicious […]

Continue Reading »
Mar 31, 2012
tom

Why qmail queue is full of files?

Yesterday my server stopped working properly. After some digging, I found that the problem is that /dev/sda1 run out of inodes. Now I’m looking for some files to delete and I’ve found that at the qmail queues (todo, mess, intd, etc) are myriads of small files (the name is a number) that just contains a non-existing email address like: u0p12919Fanonymous@r33422.ovh.net or Tr33422.ovh.net-root@r33422.ovh.net or, even, there are a few like Froot@r33422.ovh.net The question is, what are […]

Continue Reading »
Mar 29, 2012
tom

How do I find files with “#” in their names, on Windows Server 2008?

I’m trying to locate all the files on my server which use a # as part of their name, and can’t seem to get the servers’ file search feature to restrict its result to only # files. How do I go about doing this? Asked by blueberryfields You can use cmd: dir *#*.* /s Answered by Mircea Vutcovici Check more discussion of this question. Bookmark on Delicious Digg this post Recommend on Facebook share via […]

Continue Reading »
Mar 24, 2012
tom

Comparing owners and permissions of content of two folders?

How to to compare owners and permissions of content of two folders? Is there something like diff command which compare recursively two folders and display owner and permissions differences? Asked by RCola The solution, as with all things, is a perl script: #!/usr/bin/perluse File::Find;my $directory1 = ‘/tmp/temp1′; my $directory2 = ‘/tmp/temp2′;find(\&hashfiles, $directory1);sub hashfiles { my $file1 = $File::Find::name; (my $file2 = $file1) =~ s/^$directory1/$directory2/; my $mode1 = (stat($file1))[2] ; my $mode2 = (stat($file2))[2] ; my […]

Continue Reading »
Mar 21, 2012
tom

How can I see which applications have accessed a certain file within a given time period on Linux?

Is it possible on Linux to find out which applications have accessed a certain file in the last 24 hours? I’ve come with a few possible solutions: Watch lsof. It works, but it’s constrained to watch’s granularity. inotify sounds good… but no information of the application accessing the file is provided. auditd may be useful, but I haven’t checked that yet. What ways can I see which applications have accessed a certain file within a […]

Continue Reading »
Pages:1234567...14»