You said before, a federal law could require me to provide a SSN in order to get some benefit, right?
That's correct. Some government benefits or services, requires from you to provide a SSN. That's regulated by federal or local law.
Good to know that. Say, what about those are students?Do they need to present some permit?
Indeed, they need to do that. Any F-1 student who need a replacement, must present the I-766 work permit from DHS.