Take the 2-minute tour ×

I wanted to have a look at source code of basic networking services like FTP, Telnet, rlogin etc.

Can anyone tell where can I get them. By the way, its not that i didn't google it, e.g. searching for ftp, gives me list of so many ftp variants, but i am intersted in looking at a ftp client/server which ships with Ubuntu.


share|improve this question
add comment

3 Answers

up vote 1 down vote accepted


If it's specifically Ubuntu source code that you are interested in, it's easy. Go to a package description page such as http://packages.ubuntu.com/lucid/net/ , follow the relevant links, and look for a link to a .orig.tar.gz file in the package description. Ubuntu packages all work this way.

share|improve this answer
i mentioned ubuntu just as an example, basically i want to know whats the ftp code that runs by default on most linux distros. –  Anonymous Oct 16 '10 at 5:33
@Anonymous I see. Well, all Linux distributions pretty much rely on the same codebases, the differences are in the patches that are the other essential components of a package, and in default configuration files. So you can still use the web directory of any well-organized distribution to get what runs on most of them. –  Pascal Cuoq Oct 16 '10 at 5:39
add comment

Source code links are at the top of package pages on http://packages.ubuntu.com/

share|improve this answer
add comment

here are the code

$ftp_server = “www.yoursite.com”;
$ftp_user_name = “username”;
$ftp_user_pass = “password”;
$conn_id = ftp_connect($ftp_server);
echo “FTP connection has failed!”;
echo “Attempted to connect to $ftp_server for user $ftp_user_name”;
} else {
echo “Connected to $ftp_server, for user $ftp_user_name”;
$dir = “”;

function filecollect($dir,$filelist) {
global $conn_id; //Get our ftp
$files = ftp_nlist($conn_id,$dir); //get files in directory
foreach ($files as $file) {
//$isfile = ftp_size($conn_id, $file);
if($isfile == “-1″) { //Is a file or directory?
$filelist = filecollect($dir.’/’.$file,$filelist,$num); //If a folder, do a filecollect on it
else {
$filelist[(count($filelist)+1)] = $file; //If not, add it as a file to the file list
return $filelist;

$filelist = filecollect($dir,$filelist);

echo “<pre>”;
echo “</pre>”;

$filelist = filecollect($dir,$filelist);

echo “<pre>”;
echo “</pre>”;
$myFile =$new[1];
//echo “$myFile”;
$fh = fopen($myFile, ‘r’) or die(“can’t open file”);
//$stringData = “Ashwani\n”;
//fwrite($fh, $stringData);

$the = fread($fh, 1000000);

<form action=”" method=”post” enctype=”multipart/form-data” name=”form”><table width=”100%” border=”0″>
<td><? echo $new[1];  ?></td>
<td><textarea name=”textarea” cols=”40″ rows=”40″><? echo $the; ?></textarea></td>
share|improve this answer
add comment

Your Answer


