码字,思考,让生活留下印记,踏实地走好每一步!~ Robert

Solution after sudo/su is ruined

图像

Table for linux user/group permission format .

The command “sudo chmod -R 777 /usr” ruined /usr/bin/sudo and /usr/bin/su

After ruined, when “sudo …” is executed, error occurs like

$ sudo
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

or

$ su
Password: 
su: Authentication failure

According to the hints of error, this problem is solved by rebooting computer into a chroot mode, and execute following command

# chmod 4755 /usr/bin/sudo

# chown root:root /usr/bin/sudo # this makes ‘sudo’ owned by root (uid=0)

# chmod u+s /usr/bin/sudo        # this set the ‘setuid’ bit, which is the third character in first triad

Explaination of setuid:

setuid and setgid (short for “set user ID upon execution” and “set group ID upon execution”, respectively)[1] are Unix access rights flags that allow users to run anexecutable with the permissions of the executable’s owner or group respectively and to change behaviour in directories. They are often used to allow users on a computer system to run programs with temporarily elevated privileges in order to perform a specific task. While the assumed user id or group id privileges provided are not always elevated, at a minimum they are specific.

 

Categories: Alive Tags: , ,

韩寒谈姑娘

韩寒的文字虽然有些粗,但是话粗理不粗。最近也在思考,人应该以怎样的理想活着,是“崇高”的为了达到某精神境界?或者是“现实”的钱,车,房,姑娘?关于姑娘,韩寒的《1988:我想和这个世界谈谈》有这样一段叙述:

“对于当时的我这样从来没有弄明白自己有什么追求的人来说,姑娘就是唯一的追求。这种追求是多么的煎熬,这让我懂得了人生必须确定一个目标的重要性,无论车子、房子、游艇、飞机,都比把—切押在姑娘身上要好很多,因为这些目标从来不会在几个客户之中做出选择,只要你达到了购买标准,你就可以完全的得到他们,并且在产权上写上自己的名字,如果有人来和你抢,你可以大方地将他们送进监狱。但是姑娘不一样,把一个姑娘当成人生的追求,就好比你的私处永远被人握在手里一样,无论这个姑娘的手劲多小,她总能捏得你求死不能,当她放开一些,你也不敢乱动,当你乱动一下,她就会捏得更紧一些,最残忍的是,当她想去向其他的怀抱的时候,总是先捏爆你的私处再说。这种比紧箍咒更残忍的紧什么咒,使你永远无法淡定神闲。我知道生命里的各种疼痛,我发现这种疼是最接近心疼的一种疼痛,让你胸闷、无语、蜷缩、哭泣。这便是不平等
爱情,当你把手轻抚在她们的私处上,总想让他们更快乐一些的时候,她们却让你这样的痛苦。我常常看见那些为爱情痛苦的同学们,但我无法告诉他们,人生爱情是什么,我也正沉沦在里面,自闭和防备从来不是解决问题的答案。 ”

 

Categories: Alive

MATLAB error: libstdc++.so: version `GLIBCXX_3.4.15′ not found

Although I check with commands in terminal

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC

which shows version GLIBCXX_3.4.15 exists, MATLAB still repeats this error. After googling, I found that MATLAB searches the libraries firstly within its own library path /usr/local/MATLAB/R2012a/bin/glnxa64/ or /usr/local/MATLAB/R2012a/sys/os/glnxa64 and then the system library path. The build-in library is somehow out-of-date, and the version GLIBCXX_3.4.15 doesn’t exist in the old library. 

I tried to rename the build-in library into another name so that MATLAB can be forced to find the correct one, but there still many other candidates library files with the same name which are prior in the searching order. I need to rename all these old libraries with the same name to help MATLAB direct to correct one, which would be troublesome. 

Finally, I found an easy way to solve the problem by linking the correct library file with the MATLAB firstly searched old library file, i.e.,

sudo ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16 /usr/local/MATLAB/R2012a/bin/glnxa64/libstdc++.so.6

After running this command in my terminal, the world calms down.

Two basic probabilistic proofs[zz]

Repost from http://djalil.chafai.net/blog/2011/08/23/two-basic-probabilistic-proofs/

Very elegant proof!!

Johan Jensen (mathematician)

I enjoy basic beautiful mathematical proofs. I see them like small jewels, that I collect from time to time. In this spirit, this post proposes probabilistic proofs of a couple of basic results.

Jensen inequality. The Jensen inequality states that if X is an integrable random variable on Rn and φ:Rn→R a convex function such that φ(X) is integrable, then

 

φ(E(X))≤E(φ(X)).

 

To prove it, we start by using the convexity of φ, which gives, for every integer n≥1 and every sequence x1,…,xn in Rn,

 

φ(x1+⋯+xnn)≤φ(x1)+⋯+φ(xn)n.

 

Now, we use the integrability of X and φ(X): we take x1,x2,… random independent and distributed as X, we use the strong law of large numbers for both sides, the fact that φ is continuous for the left hand side, and the fact that if P(A)=P(B)=1 then A∩B≠∅. I also appreciate the proof based on the equality for affine functions, the variational expression of a convex function as the envelope of its tangent hyperplanes, together with the fact that the supremum of expectations is less than or equal to the expectation of the supremum. Read more…

Categories: New Tech

Debugging in Python[zz]

Repost from http://pythonconquerstheuniverse.wordpress.com/category/python-debugger/

As a programmer, one of the first things that you need for serious program development is a debugger.

Python has a debugger, which is available as a module called pdb (for “Python DeBugger”, naturally!). Unfortunately, most discussions of pdb are not very useful to a Python newbie — most are very terse and simply rehash the description of pdb in the Python library reference manual. The discussion that I have found most accessible is in the first four pages of Chapter 27 of the Python 2.1 Bible.

So here is my own personal gentle introduction to using pdb. It assumes that you are not using any IDE — that you’re coding Python with a text editor and running your Python programs from the command line.  Read more…

Categories: Alive Tags: ,

Remote Linux Server in X11 mode from Windows

This post is to help you remote linux server from Windows, especially with X11 display specified.

First step is installation of Cygwin including OpenSSH package.

Then, it is followed by installation of X-Win32.

No need to set any configuration to PuTTY in X-Win32, all you need are the following two commands in Cygwin with X-Win32 opened.

1) ssh -X -p [your port] [usrname]@[linux server address]

2) export DISPLAY=[host address]:0

Hope this would help you!

Categories: Gallery

Instructions for Installing RPM Files Using Alien [zz]

Repost from Ubuntu Blog.

Installing Alien

You can install alien itself from the Ubuntu Universe repository by adding the repository to your list of sources and doing:

$sudo apt-get update
$sudo apt-get install alien

Installing the .rpm file

To install the .rpm file, you first need to convert it to a .deb file which can be installed on Ubuntu.
I assume that you downloaded the package to your Desktop (~/Desktop is the directory)
You can convert the .rpm to a .deb by using the following commands.
$cd ~/Desktop
-This will change the directory to your desktop, where you have the .rpm file.

$sudo alien -k name-of-rpm-file.rpm
– This will convert the .rpm to a .deb.
– The “-k” will keep the version number. Otherwise alien adds a “1″ to the version number.
– Tip: Use Smart Tab Completion to avoid mistyping the file names :)

$sudo dpkg -i name-of-deb-file.deb
– This will install the .deb package

Try reading the alien manpage for more details on how to convert other kinds of packages and the options available.

Categories: Ubuntu