Skip to main content

Remote Desktop Connection to Linux (Fedora 16) from Windows 7

I’ll explain how to connect Fedora linux remotely from Windows. You have plenty of choices to do that. Two of them are here:

  • TightVNC Viewer
  • TeamViewer

First of all, you should allow other users to connect your linux desktop. On Fedora, follow this path: “Activities > Applications > Desktop Sharing“. Click to “Allow other users to view your desktop“.

Fedora Remote Connection Settings
Fedora Remote Connection Settings

You may also need to disable or set your Firewall on Fedora.

Method 1:

Download and install TightVNC Viewer. Type linux IP address and connect.

Remote Connection with TightVNC
Remote Connection with TightVNC

Method 2:

Download and install TeamViewer. Start TeamViewer on Linux. Write your ID and password down. Open TeamViewer on Windows. Connect to linux using ID and password that you wrote down.

Remote Connection with TeamViewer
Remote Connection with TeamViewer

P.S. TeamViewer is faster than TightVNC.



Remote server connection by SSH using C#

SSH is a secure network protocol to use remote shell services or execute commands. You can connect to a remote server by SSH on Visual Studio. To do this, you need a SSH library. My suggestion is SharpSSH.

Download DLL files from SourceForge. You should add these DLL files to your Visual Studio project:

  • DiffieHellman.dll
  • Org.Mentalis.Security.dll
  • Tamir.SharpSSH.dll

To connect to server and execute commands, code is here:

SshExec shell = new SshExec(hostIP, username);
shell.Password = password;
string output = shell.RunCommand(command);

My SSH application is below. It is a simple SSH Command Prompt.

SSH Command Prompt
SSH Command Prompt

Creating PDF, Word, Excel, Outlook and Text files using C#

When you develop an application that needs exporting capability for several type of files, you should use some internal or external programming libraries. I will mention a few useful and free libraries for our exporting purposes.

Data Export

I don’t want to give much explanation about these libraries because you can find out easily If you want. My purpose is giving the summary (library name and basic code) about that.

Creating PDF File

Library: iTextSharp

Document <strong>document</strong> = new Document();
PdfWriter writer = PdfWriter.GetInstance(document, new System.IO.FileStream
("C:\\test.pdf", System.IO.FileMode.Create));
document.Add(Paragraph p1 = new Paragraph("Hello World"););

Creating Word File

Library: Microsoft Word 14.0 Object Library (Internal)

Application app1 = new Application();
app1.Visible = true;
_Document doc1 = app1.Documents.Add();
doc1.Words.First.InsertBefore("Hello World");

Creating Excel File

Library: Microsoft Excel 14.0 Object Library (Internal)

_Application app = new Application();
_Workbook workbook = app.Workbooks.Add(Type.Missing);
_Worksheet worksheet = null;
app.Visible = true;
worksheet = workbook.Sheets["Sheet1"];
worksheet = workbook.ActiveSheet;
worksheet.Cells[1, 1] = "Hello World";
worksheet.Cells.HorizontalAlignment = Element.ALIGN_RIGHT;
workbook.SaveAs("C:\\test.xls", Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, Type.Missing,
Type.Missing, Type.Missing, Type.Missing);

Creating Outlook Files (New Mail Window)

Library: Microsoft Outlook 14.0 Object Library (Internal)

Outlook.Application oApp = new Outlook.Application();
Outlook.MailItem oMsg = (Outlook.MailItem)<strong>oApp</strong>.CreateItem
oMsg.HTMLBody = "Hello World";

Creating Text Files

Library: System.IO (Internal)

System.IO.File.WriteAllText("C:\test.txt", "Hello World");


To open a file, use this code:


Before using any library (dll), do not forget to add it as a reference (Visual Studio > Solution Explorer > Right Click on References > Add Reference):

Add Reference Windows in Visual Studio
Add Reference Window in Visual Studio