Category Archives: pc

How to install configure and manage an FTP server

2008 notice: up to date, the most complete and freeware FTP server is FileZilla. I do not have time, will, and resources to re-edit the whole guid to this software, anyway you can follow the same basic principles to setup a server

This is dedicated to all of you who would like to share with others their files, such as MP3’s, Movies, Pictures, FREE Programs, and… well whatever else you think it is a good idea to share .

Since there are many different FTP Server softwares out there, and as happened for FTP clients, some of them are free, I’ll put in here a tutorial on how to start from scratch with a free one (for instance WarFTPDaemon, which is, if not the most userfriendly, at least the most powerful; I’ll put available for download also GuildFTP, which instead is quite nice graphically, plus offers a very flexible interoperability with mIRC). Visit the Dowloads/Internet section of this site to get the installers.

 

Install and run the thing.

Let’s come to the tutorial itself.

This is how appears the server’s console when you start it. We’ll explain what to do step by step.

 

After the server is installed and running, we’ll have to set how many people can login, what port the server will be listening on, blah, blah, blah.

You have right now the chance to change the port the server will listen on, just put another number in place of 21 (the IP near the port can’t be changed, it logs your IP when you’re connected, and is 127.0.0.1 when you are offline). You can use virtually any numer, but avoid to use 23, 25, 80, 110, 139, which may (actually in very rare cases) interfere with your current other running services, and in general, choose with no problem any number from 1024 to about 65000. Then, the max decent number of users, unless you are on a T3, is 2 max for a 56k, even 3 for a 64k ISDN, 5-6 for a 128k ISDN, 8-10 for an aDSL, even a bit more for cable users. But still it’s your choice, the more users will connect at the same time, the slower they’ll go .

Next, you need to set users. One choice is to make an account for each person you want to access the server, asking them what username and password they prefer; or, if you, for example, serve songs in an IRC channel, it is much better to create a single account, with a standard username/password, like channelname/napstersux0rs (hey ’tis just and example ). Then you need to set the folders each user will be able to access, and what rights will have in those folders.

Reach the Edit User dialog by doing [Properties > Security > Edit User…]. You add users by pressing the Add button in the User panel side, then specifying a username (case sensitive), and a password (also case sensitive; you’ll be asked to retype it for security purposes; in this case, the login was ID:John PSW:Smith). Then switch to the File Access panel from the Security one. This is how you should set the (default permissions), that is, everything is disabled by default, you’ll specify for each folder if it is accessible or not.

 

And this is how you should set the parameters for the shared folders. To add a shared folder, press the Add button in the File Access panel side, and a dialog to choose the folders will appear. The Read right is to enable the download of the files. Uncheck the Write Delete Execute rights, to avoid l4m3 users from messing on your HD via FTP. The List (dir) right is to allow the user to see the folders he can access. Disable Create Remove to avoid a user from messing, as I told before. The Root and Home attributes are used to make the user automatically access the selected folder when he logins. If you want a login for each user, just keep adding them from scratch, till you feel you have enough accounts. When it is really all done, press the OK button in the upper right corner.

 

When you setted the user parameters, you need to adjust the overall server options, by doing [Properties > Options]. I won’t paste in here a screenshot for every panel, since you can follow the instructions by reading in here, and also because this page would get simply HUGE to download. So, you have the [Options > General] panel in front of you. I suggest you to enable Go online when started and minimize so the server, will be there ready to act. The rest if left to your will, only remember that selecting Advanced. Please enable all options you’ll find the Edit User panel a but more messy. Just use this option when you’ll become more acquainted with the program .

Switch to the Server Name panel (we can ignore for now all the other panels, which control the advanced options, and are not supposed to interest a first time user). In that panel, put a nice name for your server, like "FrAnKiE’s FrEe FoR AlL FiLeZ SeRvEr", and if you want insert your email, or leave the invalid default one.

This is done! I mean… almost… actually the two great capabilities of WarFTPd are folder mapping, and especially the Virtual File System. Since you can now start sharing your files, you can avoid reading further. But if you want to add more folders located on different disks/partitions (for example one with songs, another with pictures, another with programs and so on, and also a folder to let users upload files to you) it may be VERY useful to activate the disk mapping (I’ll avoid explaining how to use the Virtual File System, both because it should be used only by advanced users, and beacuse… err.. well… I still gotta fully understand how it works … but hey! I had to learn WarFTPd JUST to write down this tutorial!).

 

Now, let’s make an example: you have all your songs on the partition G:\, some pictures in F:\Docz\Images\…\, and want to add an Upload folder in F:\Temp\Uploads\ (well, this is more or less how my disk is organized, I suppose you don’t have so many partitions, but it will make the same, just change the example folders to the real names ).

Now, it would be a nice idea to create an empty folder just for the FTP (which will work actually only as a container for the links to the other, external, folders), let’s say F:\FTP\.

What will you have to do? Add the empty container folder in the File Access panel as I explained before. For this one, set the Read and List (dir) rights, plus the Recursive, Root and Home attributes. Then simply keep adding the other folders you want to share, selecting Read, List (dir), Recursive and Mapping.

When you select Mapping, the Alias dialog will appear, letting you specify the name which the folder will get when added to the Root of the Server. The G:\ folder will keep its current position, only there will be a link, named, suggestively, "Songs", which will appear as a folder inside F:\FTP, which, double clicked, will bring the user to G:\, as if it actually were F:\FTP\Songs. Kewl eh?

 

This is how you shoul set the Uploads folder. That is, activate the Write (file) and Create (folder) rights, to allow users organize their uploads in folders (for example, they can upload files in folders named after them, so you can know who sent you that file). The uploads folder will appear as "Upload Here" in the server root. Note: disable the Delete/Execute/Remove rights to avoid L4M3 users from deleting what others have uploaded to you. Also, you can disable the Read attribute, if you want to avoid users from downloading what others uploaded.

 

You can add as many folders as you want, building a very complex server.

 

Pheewww it’s done for real now.

 

Wait! Not yet! Do you want to know how to test yor server, even if you aren’t connected to the internet? Use an FTP client, and put all the data of the server (port, username and password), BUT use 127.0.0.1 as the IP. You will connect to your own computer, and see how the server works on the user-side.

A guide to FTP clients and to downloading files from FTP servers

Well, you gotta know the server details, first of all the IP address, or, if existing, the alias (something like “nick.dyndns.org” or “nick.cjb.net”). If the server is private, as often it is, you’ll have to know the port it’s listening to (the standard one is 21, but you may find 22, 23, 59, 92, and so on… with all the numbers from 1024 to 65000) and the UserID/Password (the “Login”). Important: usually both UserID and Password are case sensitive, and preserve spaces, so if the password is “Polly Wanna Cracker” you gotta use exactly “Polly Wanna Cracker” and not “pollywannacracker”!!!

And how do you connect?

You need an “FTP Client”. If you don’t have it, and want to find a free one, just search on www.google.com for “free ftp client”. 2008 notice: the author now uses, and suggests, FileZilla, a very good free ftp client

Suppose you are connecting… after some messages like:

[04.35.51] Connected to xxx.xxx.xxx.xxx Port xx
[04.35.52] 220 Server ready ...
[04.35.52] USER XXXXXX
[04.35.52] 331 Password required
[04.35.52] PASS (hidden)
[04.35.52] 230 User logged in.
[04.35.52] SYST
[04.35.53] 215 UNIX Type: L8

you’ll start receiving the Directory Listing, and will be able to browse as it was Windows Explorer.

To download a file, usually it is sufficient to drag from where they are, to the near window, which represents your Hard Disk, and then you may need to press a button like “Go”, “Start”, “Transfer”, or search an entry like those in the menus.

To close, I’ll add a tutorial, based on FlashFXP (if you have CuteFTP, you may try as well this one, which is undoubtedly better).

Let’s suppose the server is at the address someone.cjb.net (so [FTP > Quick Connect], write someone.cjb.net near “Server:”), port 53627 (write 53627 near “Port:”), UserID equal to your current nick on IRC (if you are Joe^74 write Joe^74 near “User Name:”), and password This is a joke (what will you write? This is a joke near “Password:”, it is clear, since I told you to maintain letter cases and spaces; not of course thisisajoke, otherwise you didn’t understand a fig, so scram).

Finished? Good, then just press “Connect” and you’ll start:

[04.35.51] Connected to someone.cjb.net Port 53627
[04.35.52] 220 Server ready ...
[04.35.52] USER Joe^74
[04.35.52] 331 Password required
[04.35.52] PASS (hidden)
[04.35.52] 230 User logged in.
[04.35.52] SYST
[04.35.53] 215 UNIX Type: L8

and it’s all done.

Create PDF files from any document type for free

2008 notice: now that OpenOffice can create PDFs natively just by pressing a button, this guide is really useful to create PDF in other applications: everywhere you have access to a “print” function, you can use this procedure to create a PDF.

Yes, there is indeed a way to create a PDF out of every kind of printable document, paying nothing to Adobe, and without any legal infringement. It is called “GhostScript”; it is a freeware tool ported from UNIX environment, distributed under the GNU license, and is capable of coverting any Postscript document to PDF format. What do you need? First, the document , then a fake printer driver, which you will use to create a Postscript file from the data to print, and finally the tool itself, Ghostscript.

There are different kinds of Postscript printers among the ones you can choose in the drivers list which come with Windows, but we’ll take the HP Color Laserjet PS; just do this: [Start > Settings > Printers > Add Printer], then choose “Local Printer”; now, depending from your OS, the screens will appear in a different order, but you just need to select “FILE:” as the printing port:

Here is an example of the dialogue you’ll be facing

and select the previously told model, HP Color Laserjet PS, in the Printers list:

The printer, selected and ready to be installed.

If you already have a real printer, I obviously suggest you NOT to set this one as the default printer .

First step completed. When you’ll want to create a PDF, just go in the “Print…” menu of the application (usually [File > Print…]) and select this printer as the output. You will then be asked for the name and the location where you want to put the .PRN file.

Second: you now need the tool to convert from PRN to PDF. Just get Ghostscript from the Downloads/Tools section (you need to get also Ghostview, a preview tool to see how the document will look — you can get both of them also on the official page).

Installed the two tools, start Ghostview, and open from there the PRN file you created; you can now see the screen preview:

This image has been intentionally compressed to reduce its size, don’t worry about the quality of the conversion, it is very good.

Do [File > Convert], select PDFwrite as peripheral, and leave the quality to 600dpi; after this, choose where to put the PDF file.

Done!

Batch script to copy your backups from cd/dvd optical disks to a hard disk/nas

4/14/2010. I recently decided to drop the habit of backing up all data to optical disks and use a 2 terabyte external hard disk instead. Not exactly cheaper, but what you lose in money (just once) you gain tenfolds in speed, comfort and ease of use, and physical space needed for storage. So I got a 2TB hard drive and fitted it in a USB external box.
Backing up all the new stuff there is no big deal, but it surely was to move the contents of the hundreds of “old” CD/DVD’s in there; doing it manually by dragging files onto the drive was going to be the most cumbersome thing, so I thought that if I had a utility that would let me put a disk inside the cd/dvd drive, and did it all by itself, that would be great. Also this utility had to eject the disk when done, so all I had to do was change it with the next disk in the serie, and after reinserting the tray the program would go on copying files.
In other words, all I wanted to do was to take out the just copied CD/DVD and put inside the next one without even touching a file manager but keep doing whatever else it was that I was doing (writing this howto for example, while every few minutes I reach to the disks stockpile and exchange the disk in the drive). Obvously, abiding by Murphy’s law, there was no such thing, or at least a hour worth of search didn’t bring up anything. Either I went full-manual or I made something like it myself: the time I was going to spend on the development would surely have been way less than the time I would have needed to select files, drag them to the drive, then wait for it to finish to change disks.

My choice fell onto AutoHotKey as the scripting tool (I already knew a little of it, plus it had just the functions I needed), so I invested some more than an hour into studying the language and building up from scratch the code to do exactly what I needed.
And in short, here it is (do not copy it yet, you need to read explanation below):

while 1
{
	empty = 1

	while empty
	{
		DriveGet, status, StatusCD, E:

		if (status = "stopped" OR status = "not ready")
			empty = 0
		
		Sleep, 500
	}


	SetWorkingDir, E:\

	Loop, *.*, 2, 1
		FileCreateDir, M:\%A_LoopFileFullPath%
	
	Loop, *.*, , 1
	{
		if (A_LoopFileName != "filename1.ext"
		&& A_LoopFileName != "filename2.ext"
		&& A_LoopFileName != "filename3.ext")
		{
			docopy = 0
			IfExist, M:\%A_LoopFileFullPath%
			{
				MsgBox, 4, Overwrite file?, Overwrite file %A_LoopFileFullPath%?
				IfMsgBox, Yes
					docopy = 1
			}
			else
				docopy = 1
			if docopy = 1
				FileCopy, %A_LoopFileLongPath%, M:\%A_LoopFileFullPath%, 1
			if ErrorLevel
				MsgBox, Could not copy "%A_LoopFileLongPath%" to "M:\%A_LoopFileFullPath%" with ErrorLevel = %ErrorLevel%.
			ErrorLevel = 0
		}
	}

	Drive, Eject, E:
	
	SetWorkingDir, C:\
}
	

As I said before, do not put it in action yet, you’re very likely to need to edit it to your needs.
Replace EVERY occurence of “E:” with the correct drive letter of the cd/dvd drive you’re going to use.
Replace EVERY occurence of “M:” with the correct drive letter of the hard drive you want to copy the files to.
The part with the “filenameX.ext” is for my convenience, and probably yours as well: I have some files on most optical disks that do not need to be copied over to the hard disk, mostly being a catalog file, or maybe the exe of the player for the videos, or whatever. So in place of “filenameX.ext” you need to put the name of those files (if any) that you want the program to ignore (if you need more of them, just duplicate the central line as needed, if you need less, or none at all, either edit that part to your needs, or if you’re not good at it, you can probably leave it as it is, since I do not think there are any files in your collection that are actually named “filenameX.ext”). The “SetWorkingDir, C:\” command is just a temporary buffer for when the disk is ejected, you can leave it as long as you have a C: drive!

Save the code in text format with .ahk extension, install AutoHotKey, and double-click on the .ahk file you just created; if I receive enough requests, I’ll upload an exe version of the utility so you can skip installing autohotkey. This is how the script works: when you launch it, unless it detects the presence of a disk inside the CDrom/DVDrom drive, it does nothing; as soon as you put a cd inside, it proceeds to copy all the files that have names different from the ignored ones, to the chosen destination, respecting the folder structure. If there are any files that already exist on the destination drive, it asks you if you want to overwrite them; there’s a little problem here, I have set the filecopy to do an overwrite, but it won’t work, if I try and overwrite it will just return an error. It’s not a big deal for me as I can just press OK and the program will go on by itself without copying the file, but if you really need to do an overwrite (for example a newer version of the same file) first delete the existing file, then press OK and it should work. As soon as the whole optical disk has been processed, the script will eject the tray of your drive, and pause until it detects again a disk inside, so you have all the time you want to switch disks. As soon as you put a new disk and close the tray, the program will continue the file copy process, in a batch fashion. To close it right click in the green “H” icon that appears in the system tray and press Exit.

I tested it on my pc alone, so I won’t be giving support if it doesn’t work for you… no time for that! I just thought it would have been nice to share something like it in case someone else needed to do the same thing.
On a side note, already a handful of disks failed on me, probably we’re talking about 4%; I didn’t reach yet the point where I switched to DVDs; as far as statistics are concerned, first place for unreadable cd’s are Verbatim Datalife (not plus), second (this is a surprise) TDK Reflex, and last, Traxdata tx; still surprisingly, a green die unknown brand of CDr’s, “CDV”, the very first ones I bought in my life, hence the oldest and the ones burned the longest time ago (about 9 years), were all perfectly readable; perfect results, at least until now, and with top reading speeds, are TDK metalAZO with white printable surface, and Verbatim DataLifePlus with silver surface, both of them (guess what) with blue die; special mention goes also to the TDK d-view’s, and the Verbatim Pastel-Disc, no failures there as well.

mIRC script to check and show the pc uptime

Wouldn’t it be nice if just by issuing the command /uptime you could send to the window you have currently open a test like this?

This is what just appeared when I typed /uptime in my mIRC. Obviously my nick has been ripped off for privay reasons

 

It is much more complete than any simple uptime script which tells only your current uptime… I mean, it records you highest time!

Obviously, it requires scripting. Then, as usual, let’s see how the code works, and then let’s comment it.

Open your Aliases Panel, pressing the button, and add this code:

/checkuptime //if ($calc($ticks / 1000) > %UptimeRecord) //set %IlGiorno $asctime(d mmmm) | //if ($calc($ticks / 1000) > %UptimeRecord) //set %UptimeRecord $calc($ticks / 1000)

/uptime {
  //if ($calc($ticks / 1000) > %UptimeRecord) //set %UptimeRecord $calc($ticks / 1000)  
  //say 9,1 It is $day $+ , $time $+ , here in the Italian slumps, and 4Windows $os 9runned *cough*smoothly*cough* for8 $replace($duration($calc($ticks / 1000),2),wk,$chr(32) $+ Week,hr,$chr(32) $+ Hour,min,$chr(32) $+ Minute,day,$chr(32) $+ Day) $+ 9 $+ . Record:7 $replace($duration(%UptimeRecord,2),wk,$chr(32) $+ Week,hr,$chr(32) $+ Hour,min,$chr(32) $+ Minute,day,$chr(32) $+ Day) 9( $+ %IlGiorno $+ )
}

Now, we need to access the Remote Panel, by pressing the button, and add this line:

on 1:START:/timeruptime 0 40 /checkuptime   

or if you already have an on START in there, followed by { and some lines, insert "/timeruptime 0 40 /checkuptime" without quotes just before the } at the end.

You need to add a line also to the Variable Panel, accessible by reaching the Remote or Aliases Panels, and then clicking on the Variables tab. Here add this line:

%UptimeRecord 0

Now press OK and restart mIRC.

This script will check for you every 40 seconds if the current uptime is higher than the stored one, and if it is, updates the record, and stores also the current date. You can change the frequency the script checks the uptime by putting a different value in "/timeruptime 0 40 /checkuptime", for example use 60 instead of 40 if you want to check every minute.

Needless to say, you can, or better you must change the message as well, since as you can see it fits my being italian . Just write what you like, and format the colours and text attributes as you prefer.

This is all, type /uptime and press Enter to see the result.