Uhm, no? I've only seen it in recent CentOS (older versions didn't have it),
and maybe Fedora does this as well.
> I think the question is asking you to use /lib/ld.so, but it's a bit of a weird question to ask.
Not really. You can do it in any number of ways, including using
Perl/Python/Ruby, writing a short C program, or overwriting another file with
execution permissions. My favourite way is a surprise to most people only
because they don't know how ELF binaries work.
> Most distros symlink /bin to /usr/bin.
>
> Uhm, no? I've only seen it in recent CentOS (older versions didn't have it), and maybe Fedora does this as well.
Arch, Ubuntu, Debian all do it.
> Not really. You can do it in any number of ways, including using Perl/Python/Ruby, writing a short C program, or overwriting another file with execution permissions.
Only the last one is a clever solution. "Just write a program" isn't a fun answer. :P
> My favourite way is a surprise to most people only because they don't know how ELF binaries work.
What do you mean? They didn't know there's a copy of the same binary?
>> Uhm, no? I've only seen it in recent CentOS (older versions didn't have it), and maybe Fedora does this as well.
> Arch, Ubuntu, Debian all do it.
I haven't checked Arch, but neither Ubuntu 16.04 nor Debian Jessie haven't
created /bin as a symlink.
>> You can do it [restoring execution bit on /bin/chmod] in any number of ways [...]
> Only the last one is a clever solution
On interview you don't need to have the most clever answer. It's better to
show you understand the mechanisms underneath by having several sensible ways.
> What do you mean? They didn't know there's a copy of the same binary?
> Most distros symlink /bin to /usr/bin.
Uhm, no? I've only seen it in recent CentOS (older versions didn't have it), and maybe Fedora does this as well.
> I think the question is asking you to use /lib/ld.so, but it's a bit of a weird question to ask.
Not really. You can do it in any number of ways, including using Perl/Python/Ruby, writing a short C program, or overwriting another file with execution permissions. My favourite way is a surprise to most people only because they don't know how ELF binaries work.
> Most distros symlink /bin to /usr/bin. > > Uhm, no? I've only seen it in recent CentOS (older versions didn't have it), and maybe Fedora does this as well.
Arch, Ubuntu, Debian all do it.
> Not really. You can do it in any number of ways, including using Perl/Python/Ruby, writing a short C program, or overwriting another file with execution permissions.
Only the last one is a clever solution. "Just write a program" isn't a fun answer. :P
> My favourite way is a surprise to most people only because they don't know how ELF binaries work.
What do you mean? They didn't know there's a copy of the same binary?
>>> Most distros symlink /bin to /usr/bin.
>> Uhm, no? I've only seen it in recent CentOS (older versions didn't have it), and maybe Fedora does this as well.
> Arch, Ubuntu, Debian all do it.
I haven't checked Arch, but neither Ubuntu 16.04 nor Debian Jessie haven't created /bin as a symlink.
>> You can do it [restoring execution bit on /bin/chmod] in any number of ways [...]
> Only the last one is a clever solution
On interview you don't need to have the most clever answer. It's better to show you understand the mechanisms underneath by having several sensible ways.
> What do you mean? They didn't know there's a copy of the same binary?
No, I meant this: https://news.ycombinator.com/item?id=11627670
And there is no copy of the same binary.
> I haven't checked Arch, but neither Ubuntu 16.04 nor Debian Jessie haven't created /bin as a symlink.
Odd, I could've sworn they did. I stand corrected.
> > What do you mean? They didn't know there's a copy of the same binary?
> No, I meant this: https://news.ycombinator.com/item?id=11627670
> And there is no copy of the same binary.
That's what I said, you use the ELF interpreter. :P