Grant admin privileges to a user in MediaGoblin

MediaGoblin, a Digital Asset Management System, has a lot of promise. I way toying around with the install and had a bit of a time finding out how to grant my registered user admin access. The short of it is on to do the following on the command line within the mediagoblin install directory.

./bin/gmg makeadmin username

After looking at the code and just executing ./bin/gmg to find the usage information I was then able to search around and found the following reference,User_privileges, which shows the makeadmin arguement being used. I don’t konw why it took me so long to find it but it did take long enough that I decided to post about it here.

Just for reference running ./bin/gmg –help yields the following:

bash-4.1$ bin/gmg --help
usage: gmg [-h] [-cf CONF_FILE]

GNU MediaGoblin utilities.

positional arguments:
 sub-command help
 shell Run a shell with some tools pre-setup
 adduser Creates an user
 assetlink Link assets for themes and plugins for static serving
 reprocess Reprocess media entries
 serve PasteScript replacement
 batchaddmedia Add many media entries at once
 deletemedia Delete media entries
 changepw Changes a user's password
 deleteuser Deletes a user
 dbupdate Set up or update the SQL database
 makeadmin Makes user an admin
 addmedia Reprocess media entries

optional arguments:
 -h, --help show this help message and exit
 -cf CONF_FILE, --conf_file CONF_FILE
 Config file used to set up environment. Default to
 mediagoblin_local.ini if readable, otherwise

Stop Android Developer Tools (ADT, Eclipse Juno) from crashing on auto-complete

I don’t know for use if this is specific to Ubuntu/Mint but when I was trying to use the ADT to write some android applications Eclipse would crash as soon as it brought up the auto-complete when typing. The work around I found was to add the following line;
into the following file;


My resulting eclipse.ini now looks like the following and ADT no longer crashes when I try typing code!

Possible reference:

How to check if your java version is 32bit or 64bit

To check which version of java you have in a terminal you can specify the -d32 for 32-bit mode or -d64 for 64-bit mode to the java executable. This should work for any operating system that supports java including Linux, Windows, Solaris, and Max OS X.

The output below shows a system that has 64-bit java.

java -d64 -version
java version “1.7.0_45”
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

That same java version however may not support the 32-bit mode as checked with the -d32 option.

java -d32 -version
Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.

On a 32-bit version only of java you will see something like the output below if you try to use the -d64 (for 64-bit mode) and the -d32 option respectively.

java -d64 -version
Running a 64-bit JVM is not supported on this platform.

java -d32 -version
java version “1.6.0_32”
Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
Java HotSpot(TM) Client VM (build 20.7-b02, mixed mode, sharing)

Ubuntu/Debian – get version of package in repository before installing via command line

First, get the package name. For this example I am trying to find what version of the Amanda Backup Client is available via command line as I often run my servers without X (or graphical tools).

sudo apt-cache search amanda
mtx – controls tape autochangers
amanda-client – Advanced Maryland Automatic Network Disk Archiver (Client)
amanda-common – Advanced Maryland Automatic Network Disk Archiver (Libs)
amanda-server – Advanced Maryland Automatic Network Disk Archiver (Server)
chiark-backup – backup system for small systems and networks
flexbackup – Flexible backup tool for small to medium sized installations

So from the above I see the package name is “amanda-client”. Now lets get the version information available with apt-cache.

sudo apt-cache policy amanda-client
Installed: (none)
Candidate: 1:3.3.0-1ubuntu1.1
Version table:
1:3.3.0-1ubuntu1.1 0
500 precise-updates/universe amd64 Packages
1:3.3.0-1ubuntu1 0
500 precise/universe amd64 Packages

Alternatively, we could also use aptitude.

sudo aptitude versions amanda-client
Package amanda-client:
p 1:3.3.0-1ubuntu1 precise 500
p 1:3.3.0-1ubuntu1.1 precise-updates 500

Package amanda-client:i386:
p 1:3.3.0-1ubuntu1 precise 500
p 1:3.3.0-1ubuntu1.1 precise-updates 500

From the information above we can see that the available version of amanda-client is 3.3.0. See Debian package version format for details on the other information in the version field.

Ldapsearch Filters: dealing with “Bad search filter (-7)” or “syntax error near unexpected token `(‘”

Typically when I work with ldapsearch I will setup an alias called “ldaps” for ldapsearch over SSL/TLS, the ldaps commands listed below thus denote an ldapsearch command like the following:

ldapsearch -v -x -H ldaps:// -D uid=someone,dc=anyspeak,dc=org -W -b dc=anyspeak,dc=org -s sub

Let’s start with a simple use case of wanting to find all UID’s that have a blank mail attribute. You might be tempted to use something like the following (see above for the “ldaps” alias) but the “!” may be interpreted by the shell.

ldaps (!(mail=*)) uid
bash: !: event not found

The “!” is interpreted by the shell and thus you might be tempted to try and escape the “!” with “\!” or even further and also escape the “*” with “\*”.

ldaps (\!(mail=\*)) uid
bash: syntax error near unexpected token `(‘

That still yields bad results so perhaps you will quote that and you might do something like the following.

ldaps “(\!(mail=\*))” uid
ldap_initialize( ldaps:// )
Enter LDAP Password:
filter: (\!(mail=\*))
requesting: uid
# extended LDIF
# LDAPv3
# base with scope oneLevel
# filter: (\!(mail=\*))
# requesting: uid

ldapsearch: ldap_search_ext: Bad search filter (-7)

We see that got us past the shell problem but now it’s not a valid filter as interpreted by the ldap server. This happens because quoting the filter also passed along the escape characters which are not valid in LDAP.

This may tempt you to just remove the escape characters.

ldaps “(!(mail=*))” uid
bash: !: event not found

But, once again we see the shell interpreting “!”.

So, what works?
How about the following.

ldaps ‘(!(mail=*))’ uid

Single quotes without escaping the operators. Another example without the alias might look like the following. Which would look for UID which starts with “an” and has an empty mail attribute and limits the scope to only search one level (-s one).

ldapsearch -v -x -H ldaps:// -D uid=someone,dc=anyspeak,dc=org -W -b dc=anyspeak,dc=org -s one ‘(&(uid=an*)(!(mail=*)))’ uid
ldap_initialize( ldaps:// )
Enter LDAP Password:
filter: (&(uid=an*)(!(mail=*)))
requesting: uid
# extended LDIF
# LDAPv3
# base with scope oneLevel
# filter: (&(uid=an*)(!(mail=*)))
# requesting: uid

# ant,
dn: uid=ant,dc=anyspeak,dc=org
uid: ant

# anthrope,
dn: uid=anthrope,dc=anyspeak,dc=org
uid: anthrope
# search result
search: 2
result: 0 Success

# numResponses: 16
# numEntries: 15

Hope that helps someone out.

It would be so much more useful if they would timestamp history©