URL file-access is disabled in the server configuration

I’ve recently upgraded Apache and PHP on my VPS, and one of the unpleasant surprises was that some scripts which tried including pages from remote sites (I know, not the most secure approach, but there were reasons for that) got broken.

allow_url_fopen

Traditionally, all the websites Google finds suggest that you double-check that your php.ini config has the allow_url_fopen enabled:

allow_url_fopen = On

Well, in my case it was enabled, but scripts were still broken. The really weird thing was that the upgrade procedure didn’t include changing the php.ini in any way, so it was fully working before and I kind of expected it to continue working.

allow_url_include

After some quick research, I’ve found out that PHP 5.1 introduced a new security option to accompany the allow_url_fope, and this was exactly the option which broke my scripts:

allow_url_include = On

There you have it, hope it helps you next time you come across this problem!




Ubuntu: Using Sudo to Grant User Privileges

If you have used your fresh Ubuntu install for longer than half an hour, chances are that you’ve discovered the sudo command already.

sudo allows certain users to execute a command under another user’s privileges. Most commonly, using sudo implies running a command as a superuser, but the approach works equally well for allowing you to inherit a user ID (uid) and group ID (gid) of any user on the system.

To gain access, a password is asked, and by default it is your password, and not the password of a user you’re trying to run a command as. This allows for the system’ s administrator to effectively manage user privileges without having any user share their password.

sudo is based off the /etc/sudoers file, which should be edited by root employing the visudo command. WARNING: although /etc/sudoers file is a regular text which root can edit manually, ONLY visudo way of updating it is recommended, as this command, apart from editing capabilities, also does a syntax check of the changes before applying them to prevent user privilege related disasters.

If you want to grant superuser privileges to a particular user, the following line should be added to the /etc/sudoers file (just type visudo to invoke the editor):

greys ALL=(ALL) ALL

In this example, greys is the username.

Related books

If you want to learn more, here’s a great book:

ubuntu-kung-fu-practical-guide
Ubuntu Kung Fu




Allow Incoming TCP Connections for X11 on a RedHat (RHEL4) System

Starting with RHEL4, the system only accepts local (socket-based) X11 server connections. This means that if you go to another Unix server and try forwarding X11 output by using DISPLAY variable to point to your RHEL4 box, it will no longer work.

Enabling TCP connections to X11

In order to make your RHEL4 system accept TCP connections for X11, here’s what you need to do:

In /etc/X11/gdm/gdm.conf, uncomment the

#DisallowTCP=true

line and change it to

DisallowTCP=false

That’s it! Restart gdm and enjoy!




How To: Find Out the Release Version of Your UNIX

Different UNIX-like operating systems store information about their release versions differently. If you know what OS you have, but not sure about the version, then here’s how you can find out:

RedHat Linux

bash-3.1$ cat /etc/redhat-release
Red Hat Enterprise Linux Client release 5 (Tikanga)

Ubuntu Linux

bash-3.1$ cat /etc/issue
Ubuntu 6.10 n l

SUSE Linux

~> cat /etc/SuSE-release
SUSE Linux Enterprise Desktop 10 (x86_64)
VERSION = 10

Sun Solaris

bash-2.03$ cat /etc/release Solaris 8 2/04 s28s_hw4wos_05a SPARC Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. Assembled 08 January 2004

See Also




Welcome!

H, and welcome to UNIX Tutorial – a future hub for all sorts of useful information on various UNIX systems.

The project is about to be launched by the end of August, so stay tuned! If you have any ideas/suggestions – please don’t hesitate to contact us immediately!