Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Saturday, April 25, 2009

XMing Rocks (yes, it does)!


The gnome windows manager desktop on Fedora 10

Short Story

If you need to develop on Windows and Linux, XMing will allow you to run programs on a Linux box and display them on a Windows machine.


Long Story

As the chief architect, engineer, and only developer on the CLIPC project, I need to be able to develop on Linux and Windows. Developing on Linux has been something of a chore up until now, because I had to either "rlogin" onto the machine, and give up any GUI capabilities, or physically sit in front of the system.

Cygwin-X

I've been trying to get a better setup for a couple of days and then I hit on the idea of using the ability of X-Windows to forward a display to another machine. One of the (many) problems that I encountered was getting an X-Windows server to actually run on Windows.

At first I tried to use Cygwin-X, the x-windows that comes with Cygwin, but I found it difficult to use. Any time I run a program and it seems to do nothing, I start getting testy. Specifically, I selected

 Start>Cyginw-X>Start XWin Server

After a bit of puttering about, I recalled running "startx" from the keyboard. I tried that from a Cygwin session and was "rewarded" with this:

Ugh...this actually makes Windows look good!

At this, I felt like I had been thrown into a time warp back to the 90's when you could peg the CPU of a machine running X by just bringing up a menu.

Mind you, I have tremendous respect and gratitude towards the folks who maintain cygwin. But there are limits.

Enter XMing

After glaring at Cygwin-X for a bit, I tried looking for something else. Google, after much prodding and use of something-or-other: directives turned up XMing.

I've been using MinGW for quite a while in general, and for the Windows portion of CLIPC in particular, so I am reasonably comfortable with things MING. I downloaded it and installed it in under 10min. Perhaps under 5min.

With most things Linux-like I expect stuff to take at least a weekend, so this was a very nice surprise.

At first I got the same, ugly X-Windows starting stuff, but with a little bit of reading, I determined how to fire up the gnome window manager. The way to do this is to specify "gnome-terminal" as the "start program" that you get from running XLaunch.

In the interest of being more helpful, here is what I used for the values in the XLaunch config screens:



For me the most important aspect is that it can run Eclipse. I want to have some vague confidence that my stuff will compile and run on the Linux version.

Eclipse running on Linux and forwarded to Windows

Conclusion

MingX is a user-friendly solution for those who want to forward X-Windows from a Linux box to a Windows box.

Sunday, April 12, 2009

Linux, Samba, NTFS and Selinux

The Short Story

I had a problem where windows kept giving me an "access denied" error when I tried to access a file share from Linux. Using the following commands allowed it to work:
 
semanage fcontext -a -t samba_share_t "<share>"
setsebool -P samba_share_fusefs 1

The Long Story

After converting a Windows system to a Linux system (Fedora 10), I wanted to be able to use it as a file server via Samba and furthermore to be able to access my old hard drive.

The initial problem was that I could create the share, but I could not use it via windows. Whenever I tried I received a "permission denied" error. I tried making the share world readable, etc. but this did not help.

The "secure linux troubleshooter" --- SETroubleShooter, which I found from the application>system tools menu, had a good suggestion for the solution to the problem:

    semanage fcontext -a -t samba_share_t "<share>"

This allowed Samba to share the part of the disk that I had set aside for the file server. All well and good. Then I tried to share the old system disk.

This required some special mounting options because it was formatted with NTFS. Here is the entry from /etc/mtab:

     /dev/sda2 /export/whatever fuseblk rw,allow_other,blksize=4096 0 0

The system was able to mount the volume and I could ls around it etc., but trying to share it via Samba failed. I couldn't figure out what was going on until I tried disabling SELinux entirely via the following:

    echo 0 > /selinux/enforce

I then tried the share and it worked. I then reenabled SELinux:

    echo 1 > /selinux/enforce

At this point I felt like turning off SELinux and leaving it off, but some additional looking around on the web turned up this command:

    setsebool -P samba_share_fusefs 1

For whatever reason, SELinux needs to be told separately that it should let Samba share NTFS file systems as well as regular file systems.

All this may sound nice and easy, but it took hours of hair-tearing and glaring at the monitor. I found that SELinux/Samba interactions are not anywhere near as well documented as regular Samba problems.

I found the following pages to be useful in troubleshooting this problem: