For security and other reasons this is server’s job to ensure that users stay in particular directory only.
Some SSH/SFTP servers have the function built-in (for example Vandyke VShell). The OpenSSH (the most common SSH server) have the function implemented already, but it is not released yet. See documentation of upcoming OpenSSH release (Look for ChrootDirectory keyword). So be patient. Meanwhile, you may find useful a chrootssh project.
Most FTP servers have the function built-in.