What does su > echo "" mean?

When I was entering the command

su > echo "sachin"

it was asking for a password. When I gave my password, some strange things happened as you can see:

Enter image description here

One more thing: there is another user, Hadoop, on my laptop, but when I do

su > echo "Hadoop"

it says

no passwd entry for Hadoop

What does this mean?

4

1 Answer

Ah! Nice puzzle!

Just say "exit", and all your files will be there (and the output you miss in a file called echo).

Explication:

 su > echo user 

is the same as

 su user > echo

So you are starting a (sub)shell with su (switch user) to your user, with all output redirected to a file called echo!

Look:

[romano:~] % cd tmp/dvd-usa-hd
[romano:~/tmp/dvd-usa-hd] % ls
dvd-usa-hd_01_01.avi
[romano:~/tmp/dvd-usa-hd] % su > echo romano
Password:
[romano:~/tmp/dvd-usa-hd] % ls
[romano:~/tmp/dvd-usa-hd] % exit
[romano:~/tmp/dvd-usa-hd] % ls
dvd-usa-hd_01_01.avi echo
[romano:~/tmp/dvd-usa-hd] % cat echo
dvd-usa-hd_01_01.avi
echo
[romano:~/tmp/dvd-usa-hd] % 
3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like