If your sound card supports it, you could probably do it by fiddling with the sound settings. You normally don't get into that level of control using the default volume control utility in Ubuntu, but you can run a text mode utility called alsamixer. If you find the your line input, you could locate (in the playback tab, not the capture tab) your line input. In the capture tab you can set the level of the input, but whether you can hear the input in your headphones, depends on the playback tab.
If you have multiple sound cards (or USB headphones), you might need to let alsamixer know which sound card you want to control, e.g.
alsamixer -c 0
alsamixer -c 1
...and so forth.
Note that this will only work within one physical soundcard; it will not work with e.g. a sound card and USB headphones, which are a separate sound card from the operating system perspective.
An alternative could be a low latency audio server, Jack Audio Connection Kit. It induces more latency than the hardware solution described above, but gives you more control. For just playing with a backing track, fiddling with alsamixer is sufficient.