Comments, Code and Qt. Some words about the wonderful world of software engineering

13Feb/123

‘sudo ./script.sh: command not found’ on Ubuntu

Posted by kypeli

I am pretty sure I could run my script last week, but I cannot anymore today. kypeli@ubuntu:~$ sudo ./myscript.sh [sudo] password for kypeli: sudo: ./myscript: command not found Obviously this was very strange to me because the script was in the current working directory, all permissions looked fine and I could run the script just fine without sudo, which indicated that the shebang was ok. kypeli@ubuntu:~$ ls -la ./script.sh -rwxr-xr-x 1 root root 568 2012-02-13 05:49 ./script.sh kypeli@ubuntu:~$ ./script.sh Usage: ./script.sh [foobar] Give 'foobar' to do Baz So what has happened? Apparently Ubuntu changed something in some update (I am still to verify this) which prevents me from running scripts as sudoer from other than sudo compile time predefined paths. You can verify this by looking at the flags that were used to compile sudo and look for the --with-secure-path option. sudo will not run any script (or command for that matter) outside of these paths. Including . kypeli@ubuntu:~$ cat /usr/share/doc/sudo/OPTIONS ... --with-secure-path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin" Give a reasonable default path for commands run as root via sudo. Well - this was a bit annoying to me for two reasons. I am pretty sure this worked for me last week on my Ubuntu, but suddenly it doesn't work anymore. And secondly, I am not running any public server and I want to run my own scripts with root privileges (why I want to do that is a different topic :)) if I so choose. I must stress that I can see the reasons for doing this and security is always a trade off between security and usability. I would not do this on any public server, but for Ubuntu to not allow me to run my own commands as root is a bit annoying. Luckily I found this tip from Björn Wijers' blog: http://www.burobjorn.nl/blog/2012/01/04/fix-sudo-and-path-environment-variable-on-ubuntu/ Update: Seem Björn's blog is down, so I'll post the solution here. Put the following line to your $HOME/.bashrc file:
alias sudo='sudo env PATH=$PATH $@'
And the run source $HOME/.bashrc (this will not be necessary on subsequent boots or starts of the terminal). You should again be bale to run your scripts with sudo. This will enable the fix only for me, as I put the alias in my .bashrc file, so it's not even a terrible security risk. And that's fine. I would also like to thank @anidel for pointing out initially this possibility.

Technorati Tags: , , , , , ,

9Dec/114

I passed the Nokia Certified Qt Specialist test

Posted by kypeli

I just have to put it out here; I am now a Nokia Certified Qt Specialist which means I have the right to use the logo below. I have no idea where I would use it in the future, so let's have it at least here on my blog 🙂 It's nice to be able to join the club of Qt experts. Under NDA I cannot speak about the test itself, but I can tell you that it had some tricky questions as well 🙂 But please instead poke me about any Qt question!

Technorati Tags: ,

6Dec/100

I am proud to be a Qt Ambassador

Posted by kypeli

I got some really exciting news today; I was accepted into the Qt Ambassador program! This is so exciting and it's a huge honor to join some very talented people. Now I get to enjoy all the benefits of being a Qt Ambassador and last but not least, use the Qt Ambassador logo on my site. So here it is:

Qt Ambassador

Filed under: Void No Comments
6Oct/105

Yet another Nokia N8 first impressions

Posted by kypeli

I am a MeeGo, Maemo and Qt guy, but I have been working with Nokia for a long time to have been using Symbian devices a lot. A have also owned a Nokia 5800 for a while, before I got my Nokia N900. I think I have enough credibility to be able to say a few words about the Nokia N8. I have only been playing with it for some hours now so these are really just my first impressions and I doubt I will even write a more thorough review since the Internet is probably already filled with them. I would also like to say that since I have been using the Nokia N900 for a year now, I will automatically compare the N8 to it.

Nokia N8 captured with Nokia N900

Technorati Tags: , , , ,

23Jan/101

My new professional blog

Posted by kypeli

Welcome to my new blog. I already have an other blog hosted at Blogspot, but I decided to move my blog to en other hosted server I have better access to and use WordPress as the publishing platform. I got some very nice experience with it after we set it up at work for an internal project. It really was 5 minutes and everything worked. Amazing! The idea for this fresh blog is to collect my ideas and thoughts as a professional software engineer. The earlier blog I had was more of a diary type but I wanted to change that. You should check out my collegues, Zchydem's, blog, because he has been doing this for a long time and he already has some very cool posts! I am a software engineer developing Qt in C++ and a Scrum master for a Maemo development team. These are the topics you can expect to hear from me. Stay tuned 🙂

Technorati Tags: , , , , ,